Pages

Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Monday, September 10, 2012

How to put a hyperlink in Oracle forms.....

Hi fellas,
                  Hyperlink is something like a URL. we can click on that and it will navigate us to the relevant location where we can have information we need. First of all we need to have relevant window and canvas to display the relevant information for the users. Our hyperlink will navigate the user to this newly created canvas to show the information. You can add any item like text items, display items, tables and etc...
                  To add new hyper link, first you have to add new Text item on the canvas that you need to display the hyperlink to the user. It's better change it's Visual Attribute Group as "VA_CLICK". You don't have to write anything in the "Prompt" section to display. Because hyperlinks didn't display anything in Prompt section.  Apart from that you should set BEVEL = NONE in the property palate of the text item. You should call to the newly created canvas in  WHEN-MOUSE-CLICK trigger by using SHOW_VIEW. Apart from that we can use web.Show_Document to show the relevant page to the user. But we can use web.Show_Document from within a form which run from the web.
                 If you run the form with above modification, still you wont be able to see the hyperlink. But it's there where you placed it and you can see it's functionality by clicking on the area you placed it. To display the hyperlink, you should assign a relevant name for the item within the trigger or program unit where you populate the data to the canvas where you placed your hyperlink. Otherwise it wont get display. eg - :BLK_MAIN.HYPERLINK := Hyper Link(Hyperlink name). Then only you can view this through your form.

Thursday, June 21, 2012

ORA- 12154: TNS:could not resolve service name in Oracle Formbuilder or Report builder


Hi Oracle fellas,

                            You will get above problem when you are using oracle form builder or report builder. This can happen because of various kinds of reasons. It can happen because of the error of the TNS name you are trying to connect. May be the port numbers can be wrong or something like that. You cannot connect through form builder means that form builder cannot see or find your TNSNAMES.ora file. Form builder uses the TNSNAMES.ora file and SQLNET.ora file found under the iDS suite folder - under this folder the NETWORK - ADMIN folder. Sometimes there can be syntax errors like unrelated parentheses in your TNS name. Including these kind of error makes TNS file unusable.

To overcome this problem always maintain your TNSNAMES.ora file without any errors. Keep your .ora files in proper directory.

If you are using directory naming, 
Verify that "LDAP" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the oracle net profile(SQLNET.ora).
Verify that the LDAP directory server is up and that it is accessible.
Verify that the net service name or database name used  as the connect identifier is configured in the directory.
Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP Dn as the connect identifier.

If you are using easy connect naming,
Verify that "EZconnect" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the oracle net profile(SQLNET.ora).
Make sure the host,port and service name specified are correct.
Try enclosing the connect identifier in quote marks.

Sometimes this happen when your are using particular oracle version in the first time. Reason for this kind of scenario is the problem with SQLNET.ora file. You can see few lines of statements in that .ora file. In the very first moment only first two lines were commented. Therefore you wont be able to connect to needed database via form builder or report builder. Only you have to do is comment all the lines in that file and try to connect to the database you want.

There may be different oracle products installed in your computer. Each of these products contains it's own NETWORK/ADMIN directory which is the location of .ora files. Therefore we can maintain only one TNSNAMES file for all the products in your computer. TNS_ADMIN environmental variable will allow you to do that. Take any of the TNSNAMES.ora file and put it in to a directory (like "D:\0_library") which is easily accessible and let the TNS_ADMIN environment variable point to its directory. Then do as follows,

c:\ temp>set tns_admin 
tns_admin = D:\0_library
c:\ temp

Simply log in to your database.....:)

Monday, March 26, 2012

Raise form_trigger_failure... ORACLE...

Hi Oracle fellows...:)


We all are familiar with the above phrase "Raise Form_Trigger_Failure". This statement is use  freeze the program whenever we need. Freeze means stop the whole process of the oracle program. 
Normally in Oracle forms we use this statement to freeze the form whenever an error occurred. This statement mostly helpful when you are doing higher level validations like QC validations. We can use this statement when we handle an error like prompt appropriate error message. Otherwise program will prompt an appropriate error message and will try to continue the rest of the process according to the program process and code. This will make program to prompt an Oracle error messages for user and he or she will not be able to understand those messages and will get messed up with the program.


Sometimes this statement wont work properly in WHEN_BUTTON_PRESSED trigger. Sometimes this button wont be able to freeze the form and therefore program will try to proceed with the error and will prompt an oracle error. 


This happens sometime when you are using exception handling without proper manner. I mean when trying to prompt out the exception and do nothing to handle it. Actually "Raise Form_Trigger_Failure" is an predefined exception. So in a situation like that, the program will throw you an exception without freezing it.  


For these kind of scenario, we can use above statement as below mentioned.


when form_trigger_failure
Raise Form_Trigger_Failure;


Pretty easy stuff. But you have to put these two lines within the exception handling part. It will work in a nice and smooth manner...

Sunday, March 18, 2012

FRM-40735:ON-ERROR trigger raised unhandled exception ORA-06508

After converting older version of oracle forms to forms 10g using forms Migration Assistant, you are not be able to open the application or log in to the application via web. When access from developer suit 10g, it will run without any problems. One of the problem could be the related ORACLE LIBRARY PATH which attached to it. Some times this can happens when you are changing the library path according to the module or work area you work at that moment.


In older versions of forms the library path is mapped to the client pc and the forms application refer to the mapped drive letter. In the web we couldn't find specific path. It is relative. It will automatically refer the path.


If you have above mentioned problem, you will get message from oracle form builder. It says cannot attache specific libraries to your form source. Sometimes you wont get this message but wont be able to open the form. when you look in to the form source in form builder, you will see that form didn't include any library. 


There's few solution available for this matter. 

  • Open the form in Oracle form builder. Click on Attached library and plus sign item on Object Navigator.  Locate the need .plls and press YES on the message which ask whether to remove path or not.
  • Go to the regedit through Command Prompt. Go to forms_path if you are  working with 10g2 , otherwise go to forms90_path and enter the related library path to that.
  • Go to the Oracle folder where installed it in your computer and go to the forms folder if you are using oracle 10g2. Otherwise go to forms90 folder. In that folder, go in to the server folder and you can find ENV file named Default. open it on notepad or wordpad. It includes something like "FORMS_PATH" if you are using 10g2. Otherwise "FORMS90_PATH" give the related library to that path and save it. Now whole forms is under your control. 
Now you can open the form and access via web successfully. 


Additional....

  • Don't use long paths for Library folder.
  • Keep the latest libraries which are in SVN.
  • Always replace the regedit path and default.env path when you are changing the module or oracle version accordingly.
  • Oracle 10g1 use FORMS90 AND Oracle 10g2 use FORMS.

Friday, November 11, 2011

Trigger (PRE-QUERY), set dynamically properties....


Introduction
A form trigger is a block of PL/SQL code that adds functionality to your application. Triggers are attached to objects in your application. When a trigger is fired, it execute the code it contains. Each trigger's name defines what event will fire it, for instance, a WHEN-BUTTON-PRESSED trigger executes it's code each time click on the button which trigger is attached, or we can say , a form trigger is a set of PL/SQL actions that happen each time an event such as WHEN-CHECKBOX-CHANGED, WHEN-BUTTON-PRESSED, or WHEN-NEW-RECORD-INSTANCE occurs. You can attach several triggers to data QUERY. The most populer of them are PRE-QUERY and POST-QUERY. 

PRE-QUERY Trigger
The PRE-QUERY trigger fires before SELECT statement finalized.The POST-QUERY trigger fires before selected records are presented to the user. It fires after records are retrieved but before they are displayed. So you can use it to enhance a query's in a number of ways. Your POST-QUERY trigger can contain code to calculate or populate control items.

Change an OBJECT PROPERTY DYNAMICALLY
 You can always change object property dynamically. The SET_OBJECTNAME_PROPERTY built_in sub program will change an object property dynamically.

Thursday, November 3, 2011

Insert data in to a table by using simple FOR loop.....

Recently i had to insert several number of data rows to database table related to my oracle form( For the testing purpose). There's few constrains in that particular table. Before insert data, i have to concern about those constraints. Because my insertion can violate those constraints.  I disabled relevant constraints according to my data insertion and run simple FOR LOOP mentioned below.

BEGIN
    FOR v_LoopCounter IN 1..120 LOOP
        INSERT INTO TABLE_NAME  (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,
         col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,co24,co25)
        VALUES ('TESTU'||v_LoopCounter,'test'||v_LoopCounter,'94',null,null,null,null,null,      null,null,null,null,null,null,null,'1','Y','val',sysdate,'val1',sysdate,null,
       'E',null,'N');
    END LOOP;
END;


This is very simple sql code for insert several data rows to a table. Nyway you can use any number you want for counter. It depends on the number of data rows you want to insert to your table. This is more suitable for testing purpose. Because it's really hard to edit each and every column value in each insertion. But for the simple testing purpose you can edit unique fields by adding loop counter as a part of that field value.

Tuesday, October 25, 2011

Oracle Forms - When you get "FRM-40401"message when saving...

Hi all,



Recently i had an issue with saving new data to database via my oracle form. When i enter new records via form and press save button , occurs "FRM-40401: No changes to save" message. New records were not in database. To handle this i used "STANDARD.COMMIT" instead of using "COMMIT_FORM".

The COMMIT (COMMIT_FORM) statement analyses blocks that exist in a form. If you change a table independently from the declared blocks, then the form doesn't think that it has any changes to save. It usually leads to the "FRM-40401: No changes to save" message.

But, if you use STANDARD.COMMIT, it will bypass any checking and do exactly what you have asked - commit, now!

It is also suggested to use 'standard.commit' (NOT 'commit') in procedures that reside in a form