Thursday, May 28, 2015

Arabic Characters Displayed in Question Marks

 Arabic Characters Displayed in  ?? ???



      In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that

              A frequently asking question about how to avoid retrieving Arabic characters in question marks. In Shaa Allah, today i will explain the reasons for such a problem and how to overcome it. Since it is a common and annoying problem facing most developers who are not familiar with Oracle character-set pre-installation requirements.
  

Key Problem:


    Data retrieved from database into forms in question marks ????? ??? ?????   


Key Reason:


 In fact, this problem starts on setting up "Oracle database". The Oracle Universal Installer always makes checks on the default language you specified  for your Windows Operating System.

This check makes sense to The Oracle database Installer to select the logical Character-set that fits your requirements.


     Determining Oracle Database encoding method: 


 SELECT parameter , value
     FROM NLS_DATABASE_PARAMETERS
    ;’% WHERE parameter like ‘%CHARACTERSET
PARAMETER                                        VALUE
—————————— —————————————-
NLS_CHARACTERSET                       WE8MSWIN1252
NLS_NCHAR_CHARACTERSET         AL16UTF16

 

  The Problem Reasons Conclusion   


There are two precise reasons for such problems(Question marks & junck):

1.      Incompatible"NLS_LANG" parameter with your default Windows Operating System's language.
2.     In-compatible character-set between Oracle database Server and the Client-side (forms and reports) applications.

  In other words, just for instance, if Oracle database uses UTF-8 characters, thus your client's Oracle  forms and reports applications  MUST  use the same UTF-8 Character set too. Otherwise, you will face language issues for incompatible character-set.


Key Solution:

  •  Re-installing the Oracle database with the correct character-set also expensive in time, effort and not a good alternative solution.

       Warning


Enabling the default Arabic Language on your server or pc is a necessary BEFORE reinstalling Oracle Database    ?WHY it guarantees a PERFECT selection of the Arabic and English character-set for inserting Arabic Letters  correctlybut, you will still having your OLD DATA that had inserted with the wrong character-set retrieved in question marks ??? ??? ?? so you have to re-entered it with the correct character-set.
  • Creating a new Oracle Database Instance.

    Warning:

              Oracle Express Edition is limited to a single instance on any server     Oracle licensing terms don't allow for more than one instance on a given server 
             If you need more database instances, you need to download
             Either Oracle Database Standard or Enterprise Edition.

      This solution implies two necessary steps, in some cases, related to each other.  

1.     Client Side:

                   Create a New User environment Variable named 'NLS_LANG'  give the                         following value: AMERICAN_AMERICA.AR8MSWIN1256

          2.     Oracle Database Server Side: 

                  The following workaround will help you to avoid removing and re-installing                    a new Oracle database.
   

   Create a New Oracle Database Instance Steps


1)  Take a back up from the current database.

2) Select Start > All Programs > Oracle - OraDb10g_home1 > Configuration and migration Tools >Database Configuration Assistant >Create a Data Base

3)(Press Next)    > General Purpose  (Press Next) > Global Database Name (SID)   (Press Next)  > Configure the data base with Enterprise Manager (no changes)

4) (Press Next)   > Specify  a password for your account  & confirm it (Press Next)  > File System (No Changes) (Press Next)  > Use Database file Location from Template (No Changes)

5) (Press Next)   > Specify Flash Recovery Area (No Changes) (Press Next) > Sample Schema (No Changes)

6) (Press Next)   > (a Window with 4 tabs appeared ) Select the Character Sets 's tab use the Default (Only and only if your Default Language was set to Arabic)
(Notice: AR8MSWIN1256) (IF not choose from the list of the character sets that AR8MSWIN1256) (u have also the default  Language and date u don't have to change) 

7) Data base Storage (No Changes) (Press Next)    >

8) Create Database (No Changes)  (Press Next)  > Then  Press  Finish  >

9) A General Purpose Summary Window will appear (Notice the Character Sets is now that AR8MSWIN1256 we r looking for it as selected)

10) Press OK Now the Creation Process of the data base will Start as if u r installing a new database from the beginning up to the end then Press Exit button

11) Connect your db with the new password u previously included in the Wizard and
 import the old dump then try to connect your forms with the new db,enter the data,
 save & Retrieved.




Note: The following are successful examples.

How to Test New effects  

   Fixing the problem DOES NOT CORRECT the wrong data the user had input. 
You have to RE-ENTER new data, store and retrieve it.
  Changing"NLS_LANG" parameter has NO affect on the Old stored data. 


 Run the following query. The output of your correct query result should be as follow:

SQL>  SELECT * FROM v$nls_parameters
  2  WHERE parameter in ('NLS_CHARACTERSET','NLS_LANGUAGE');
PARAMETER                           VALUE
-------------------------------   ---------------------------------
NLS_LANGUAGE                 ARABIC
NLS_CHARACTERSET       AR8MSWIN1256

Note: If  no change in data base "NLS_LANGoccurs then you have to restart the database to refresh its "NLS_LANG" with the new parameter  value.


Hope it Helps…


My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.



Wednesday, May 13, 2015

Dependent Drop Down List

Dependent Drop Down List


In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,

     
   If you are looking for the way you can populate an item list here is a good
    Working Sample Code but if you are looking for creating a dependent drop down list and it doesn't display or populate data here the error that you would face and its solution.

Key Problem:
 The problem you will face when you have two popup lists and you are attempting to populate the second  popup list depending on the selected  value of 
the first popup list is



Key Solution: 

Let's Suppose we have the first list DNAME which displays all the department names stored in the department table.
The idea of populating the second popup list depending on the selected value of the first popup list is replies in using a specific DEPTNO value to filter the values displayed according to the Second popup list


The following example is intended to populate  the emp_name in respect to the first list-item selection of e.g. DNAME 


In When-List-Changed  Trigger of the First List e.g." DNAME"  you have to write the 

following code...




 
-- The following code attain the key solution of the problem.
-- The list DNAME will be changed depending on the DNAME list value  
-- selection & filtered by the DEPTNO
 
DECLARE
 
rg_city RECORDGROUP;
rg_name VARCHAR2(40) := 'EMP';
list_id Item := Find_Item('EMP.ENAME');
vTemp NUMBER;
 
BEGIN

-- The following is checking your Group doesn't already exist through 
-- searching for it and delete it if exists.
 
rg_city  := FIND_GROUP(rg_name); 
IF NOT id_null(rg_city) 
 THEN Delete_Group(rg_name);
End if;
  
-- If it doesn't exist then create it and add your query to it
 
rg_city :=CREATE_GROUP_FROM_QUERY(rg_name , 'SELECT ENAME , ENAME FROM EMP WHERE 
         EMP.DEPTNO = '|| :DEPT.DEPTNO);
 
SET_RECORD_PROPERTY(:system.cursor_record,'EMP',status,new_status);
vTemp:=POPULATE_GROUP(rg_name);
 POPULATE_LIST('EMP.ENAME', rg_name); 
 
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
WHEN OTHERS THEN MESSAGE('Follow up the error : '||SQLERRM); 
END;


Note: in the select statement there are two database columns selected; 'SELECT ENAME , ENAME' one column for the 'List Element' and the other column is  for 'List Item Value'. In compare with 'The Static List Item' that has a fixed value; "Elements In List" property.

The following link:A Working Sample Code. 

:   Learn More about

  •  Three Steps to Forms Data Exchange "Parameter List"




My success only comes from Allah, pls. note your comments and suggestions are great 

help for me in progress thanks in advance.


Saturday, May 9, 2015

The Best 3 Steps For Handling Oracle Forms Messages

The Best 3 Steps For Handling
Messages Oracle Forms 


In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,

       One of the most critical application concerns for a developer and for an end users  is planning for handling application messages. Since, it reflects the quality of your code outputs is it buggy or it handles the end-users requirements effectively. 
   
      It is really embarrassing if  you are in the presentation at your customer's company explaining your wonderful program and one of the unpleasant informative or error messages popes up at your customer's face. Well, it's not the end of your career life, you can manage this situation tactfully. 
Let's limit the worries and start implementing a real reliable effective solution.

ask DefinitionT   
         
     Suppress Oracle Forms Informative & Error  Messages


Task Solution:

  Step One: 


     Create a database table for customizing your form errors as follow:

CREATE TABLE ERROR_MESSAGES
)
,MSG_CODE NUMBER (5, 0) NOT NULL Primary Key 
,MSG_TYPE VARCHAR2 (1) NOT NULL 
MSG_DESC VARCHAR2 (200) NOT NULL
; ( 


 Step Two:


    Run the following Ready Made English Messages Script  as a sample data of such common Oracle Forms Informative and error messages.
   

Step Three:


    Create On-Message and On-Error Triggers. Now, you paste the following optimized code into each trigger on form level with which you can handle the forms informative and error messages effectively.


DECLARE
        lv_errcod              NUMBER := ERROR_CODE;
       alert_message     VARCHAR2 (200);
  BEGIN
         SELECT msg_desc
         INTO     alert_message
         FROM   error_messages
         WHERE msg_code = lv_errcod ;
 EXCEPTION
         WHEN OTHERS THEN
       alert_message:=message_type||'-'|| To_Char(message_code)
 || ': ' ||  message_text;
 Raise Form_Trigger_failure;    
END;

        It's also a quite good idea to create a pl/sql library in oracle forms that includes a a procedure encapsulated in a pl/sql package with the previous code in order to  facilitate reusing the optimized code as an object in each form application.  




My success only comes from Allah, pls. note your comments and suggestions 
are great help for me in progress thanks in advance.