Displays the standard open file dialog box where the user can select an existing file or specify a new file.
Syntax
FUNCTION GET_FILE_NAME
(directory_name VARCHAR2,
file_name VARCHAR2,
file_filter VARCHAR2,
message VARCHAR2,
dialog_type NUMBER,
select_file BOOLEAN;

Returns VARCHAR2

See also: A Practical example of Get_File_Name built-in

Parameters
directory_name Specifies the name of the directory containing the file you want to open. The default value is NULL. If directory_name is NULL, subsequent invocations of the dialog may open the last directory visited.

file_name Specifies the name of the file you want to open. The default value is NULL.

file_filter Specifies that only particular files be shown. The default value is NULL. File filters take on different forms, and currently are ignored on the motif and character mode platforms. On Windows, they take the form of Write Files (*.WRI)|*.WRI| defaulting to All Files (*.*)|*.*| if NULL. On the Macintosh the attribute currently accepts a string such as Text.

message Specifies the type of file that is being selected. The default value is NULL.

dialog_type Specifies the intended dialog to OPEN_FILE or SAVE_FILE. The default value is OPEN_FILE.

select_file
Specifies whether the user is selecting files or directories. The default value is TRUE. If dialog_type is set to SAVE_FILE, select_file is internally set to TRUE.
GET_FILE_NAME examples
/*
** Built-in: GET_FILE_NAME
** Example: Can get an image of type TIFF.
*/
DECLARE
filename VARCHAR2(256)
BEGIN
filename := GET_FILE_NAME(File_Filter=> ’TIFF Files
(*.tif)|*.tif|’);
READ_IMAGE_FILE(filename, ’TIFF’, ’block1.imagefld);
END;

Like us to get notifications for free source code in future, thanks.

Suppose you want to change multiple images after a specified time in home screen of your oracle forms application. Follow these simple steps to create image presentation with create_timer:

(1) Place an image item on canvas and set the appropriate size and other properties for image item.
(2) Create a parameter in object navigator with any name and the data type of the parameter should be number type and specify the default value 1.
(3) You must have multiple images with name like image1.jpg, image2.jpg, image3.jpg and so on.
(4) Then create when-new-form-instance trigger at form level and place the following code:

Declare
tm timer;
begin
   ---- 3000 milliseconds = 3 seconds
   create_timer('foxtimer', 3000, repeat);
end;

(5) Then create when-timer-expired trigger in form level and place the following code:

begin
-- this will change the images in image item in every 3 seconds
  read_image_file('C:\Documents and Settings\yourpc\My Documents\My Pictures\image'||
  :parameter.nprm||'.jpg', 'JPEG', 'block3.IMAGE7');
  :parameter.nprm := :parameter.nprm + 1;
if :parameter.nprm > 10 then
   :parameter.nprm := 1;
end if;
end;

See also: Create timer to display clock in Oracle Forms


Suppose you want to import a csv file content with custom database procedure in Oracle Apex using file browse page item. Follow these steps:

Create file browse page item in Apex and choose the wwv_flow_files option to store the file.

Then create the page process and choose after submit and execution of validation option and plsql code option for the process.

In plsql area write the following code to export csv file from database (wwv_flow_files view) to server drive and then call your custom procedure to import that file's content into a table.

DECLARE
   v_upl_blob BLOB;
  vstart     Number             := 1;
   bytelen    Number             := 32000;
   len        Number;
   my_vr      Raw (32000);
   x          Number;
   l_output   Utl_file.file_type;
   erout varchar2(1000);
BEGIN
   SELECT blob_content
     INTO v_upl_blob
     FROM wwv_flow_files
    WHERE name = :P25_FB;
-- :p25_fb is the file browse item in page
LEN := Dbms_lob.getlength(V_UPL_BLOB);
l_output := Utl_File.fopen ('MY_FILES', :P25_FB, 'wb', 32760);
   vstart := 1;
   bytelen := 32000;
   IF len < 32760
   Then
      Utl_File.put_raw (l_output, V_UPL_BLOB);
      Utl_File.fflush (l_output);
   Else                                                                                                                             -- write in pieces
      vstart := 1;

      WHILE vstart < len And bytelen > 0
      LOOP
         Dbms_lob.Read (V_UPL_BLOB, bytelen, vstart, my_vr);
         Utl_File.put_raw (l_output, my_vr);
         Utl_File.fflush (l_output);
         -- set the start position for the next cut
         vstart := vstart + bytelen;
         -- set the end position if less than 32000 bytes
         x := x - bytelen;

         IF x < 32000
         Then
            bytelen := x;
         END IF;
      END LOOP;
   END IF;

   Utl_File.fclose (l_output);

   DELETE FROM wwv_flow_files
    WHERE name = :P25_FB;
COMMIT;
--- call your custom database procedure to import...
yourcustomprocedure(:P25_FB);
EXCEPTION   When Others
   Then
     IF Utl_File.is_Open(l_output) Then
      Utl_File.fclose (L_OUTPUT);
     END IF;
raise;
END;

You have created a Tree item in Oracle Apex for a particular page to use it as menu and you want that whenever user clicks a node, it will open a correspondent page. So create a table for tree menu with the following fields:

Example table Treemenu:
Create table treemenu (
program_desc varchar2(50),
module_code varchar2(50),
program_code varchar2(10),
page_no varchar2(10) );

Enter the appropriate data in the above table. You can take the idea by below mentioned query.

Now enter below query in Oracle Apex query area for the tree item:
select case when connect_by_isleaf = 1 then 0
            when level = 1             then 1
            else                           -1
       end as status,
       level,
       "PROGRAM_DESC" as title,
       null as icon,
       "MODULE_CODE" as value,
       null as tooltip,
       'f?p=&APP_ID.:'||"PAGE_NO"||':&APP_SESSION.' as link
from "#OWNER#"."TREEMENU" 
start with "MODULE_CODE" is null
connect by prior "PROGRAM_CODE" = "MODULE_CODE"


There is very good package available on Google code to create pdf files with plsql in Oracle, but some time people get confused because there are to too much links and example are there. That's why I am simply providing the code content to create pdf files with plsql. 

Click here to download Pdf_Builder_Pkg.Sql

Install this sql script to your schema and create the directory object that schema with the name MY_DIR, see the example below:

Create or Replace directory MY_DIR as 'D:\AnyDirPath\';

The below link I am providing for examples to how to use Pdf_Builder_Pkg for creating pdf files. The file contains plsql examples.

Click here to download Pdf_Builder_Pkg_Demo.Sql




More Topics

V. Kapoor

{picture#https://3.bp.blogspot.com/-q3wCssWUHo8/ViDFfCpPEuI/AAAAAAAAD0M/MHPvgnl3T3U/s1600/authpic.JPG} Vinish Kapoor is a Software Consultant, currently working in a reputed IT company in Noida, India and doing blogging on Oracle Forms, SQL and PLSQL topics. He is an author of an eBook Oracle Forms Recipes, which is available on Google play. {facebook#https://www.facebook.com/foxinfotech2014} {twitter#https://twitter.com/foxinfotech} {google#https://plus.google.com/u/0/+VKapoor/posts}
Fox Infotech. Powered by Blogger.