Thursday, May 28, 2015

Arabic Characters Displayed in ?? ???

 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:

     Enabling the default Arabic Language on your server or pc is a necessary step but not a solutionit guarantees inserting Arabic Letters but, still your data retrieved in question marks. On the other hand, Re-installing the Oracle database with the correct nls_lang is also expensive in time, effort and not a good alternative solution. 

 The Key Solution For enabling both English and Arabic Languages 


     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.

         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.

   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


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,

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.


 Three Steps to Forms Data Exchange "Parameter List":   Learn More about




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

Top 3 Steps To Suppress Messages Oracle Forms

 Top 3 Steps To Suppress
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,

During your development process in Oracle Forms,  you may face such common informative &  error messages pop up to you as any programming language.

   No one can remember every ORA- & FRM-  error number and its description. Getting this kind of unhandled messages reflect a bad impression  for the rest of  your work. It is really embarrassing especially when the dead line of your application delivery is getting closer.


    You may find yourself desperate, stressed and  unable to move forward developing the rest of you work smoothly for such annoying nonstop informative and error messages.

ask DefinitionT   
         
    
  Suppress Oracle Forms Informative & Error  Messages


Task Solution:

    Follow the next three steps:


Step One: 


Create a table for customizing Form Errors


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 & error to run as a script with a bunch of insert statement over Error_Message table that has just created in step no. one.
   

Step Three:


Create On-Message and On-Error Triggers  

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;

 

Conclusion: 

       You can make a full benefit of the three steps as:
  1.  Create a table to build a database to your form errors.
  2.   Run the following most common customized informative and error messages of The Oracle Forms.
  3. Create an On-Error & On-Message triggers Form-Level to call the customized messages just in need. 




Hope this helps…




Learn More about:






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