Home » Developer & Programmer » Forms » FRM-50026 date must be entered in a format like DD-MON-YYYY (Oracle Forms 11g, Windows)
FRM-50026 date must be entered in a format like DD-MON-YYYY [message #675511] Wed, 03 April 2019 00:55 Go to next message
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
I am creating form in which user select "CSV" File and import "CSV" Data into oracle forms Data Block.I have date column when I import date column values into data block then getting following error

"FRM-50026 date must be entered in a format like DD-MON-YYYY"

My Date Column format in "CSV" File:

https://i.stack.imgur.com/IRryV.png

My Form:

https://i.stack.imgur.com/JZgIT.jpg

Code:


DECLARE 
application   Client_OLE2.Obj_Type; 
workbooks     Client_OLE2.Obj_Type; 
workbook      Client_OLE2.Obj_Type; 
worksheets    Client_OLE2.Obj_Type; 
worksheet     Client_OLE2.Obj_Type;
worksheet2    Client_OLE2.Obj_Type; 
cell                    Client_OLE2.OBJ_TYPE;
args                    Client_OLE2.OBJ_TYPE;
cell_value      varchar2(100);
num_wrkshts     NUMBER;
wksht_name      VARCHAR2(250);
j                       integer:=1; 
BEGIN 
-- Get the name of the file to open
--v_fName := 'D:\MyDevelopment\Forms\Samples\WebUtil\Read_Excel\planets3.xls';

IF ( :BLOCK2.FILE IS NOT NULL ) THEN 

    -- The following sets up communication with the excel spreadsheet
    -- --------------------------------------------------------------
    -- Open the OLE application
    application := Client_OLE2.create_obj('Excel.Application'); 
    -- Keep the application hidden
    Client_OLE2.set_property(application,'Visible','false');

    workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
    args := Client_OLE2.CREATE_ARGLIST;

    -- Open the selected File
    -- ----------------------
    Client_OLE2.add_arg(args,:BLOCK2.FILE); 
    workbook := Client_OLE2.GET_OBJ_PROPERTY(workbooks,'Open',args);
    Client_OLE2.destroy_arglist(args);

    worksheets := Client_OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');

    -- Get number of worksheets
    -- ------------------------
    num_wrkshts := Client_OLE2.GET_NUM_PROPERTY(worksheets, 'Count');
    worksheet := Client_OLE2.GET_OBJ_PROPERTY(application,'activesheet');

    --Go to the first record
    go_block('we_group_hof_k'); 
    first_record; 

    loop
            If :system.record_status <> 'NEW' then
             create_record;
            end if;

        for k in 1..1 loop
            args:= Client_OLE2.create_arglist;
            Client_OLE2.add_arg(args, j);
            Client_OLE2.add_arg(args, k);
            cell:= Client_OLE2.get_obj_property(worksheet, 'Cells', args);
            Client_OLE2.destroy_arglist(args);
            cell_value :=Client_OLE2.get_char_property(cell, 'Value');

    --Could be done this way also -> 

    /*if k =1 then
        :dept.deptno:=cell_value;
    end if;

    if k =2 then
        :dept.dname:=cell_value;
    end if;

    if k =3 then
        :dept.loc:=cell_value;
    end if; 
    */

            --Less code this way ->
            copy(cell_value,name_in('system.cursor_item'));
            next_item;

        end loop; --for

        j:=j+1;
    end loop;--main loop

    -- Release the Client_OLE2 object handles
    IF (cell IS NOT NULL) THEN 
        Client_OLE2.release_obj(cell);
    END IF;
    IF (worksheet IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheet);
    END IF;
    IF (worksheets IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheets);
    END IF;
    IF (worksheet2 IS NOT NULL) THEN 
        Client_OLE2.release_obj(worksheet2);
    END IF;
    IF (workbook IS NOT NULL) THEN 
        Client_OLE2.release_obj(workbook);
    END IF;
    IF (workbooks IS NOT NULL) THEN 
        Client_OLE2.release_obj(workbooks);
    END IF;
    Client_OLE2.invoke(application,'Quit');
    Client_OLE2.release_obj(application);
ELSE
    Message('No File selected.');
    message(' ');
    RAISE Form_Trigger_Failure;
END IF;
END; 


How to solve this problem in Oracle Forms 11g
Re: FRM-50026 date must be entered in a format like DD-MON-YYYY [message #675513 is a reply to message #675511] Wed, 03 April 2019 03:22 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Use to_date to turn the string from the csv into a date.
Use to_char to turn it back into a string in the format forms wants.
Re: FRM-50026 date must be entered in a format like DD-MON-YYYY [message #675526 is a reply to message #675513] Wed, 03 April 2019 06:45 Go to previous messageGo to next message
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
cookiemonster wrote on Wed, 03 April 2019 03:22
Use to_date to turn the string from the csv into a date.
Use to_char to turn it back into a string in the format forms wants.
How to use this function in this code?
Re: FRM-50026 date must be entered in a format like DD-MON-YYYY [message #675527 is a reply to message #675526] Wed, 03 April 2019 06:59 Go to previous message
BlackSwan
Messages: 26707
Registered: January 2009
Location: SoCal
Senior Member
rehmankhan wrote on Wed, 03 April 2019 04:45
cookiemonster wrote on Wed, 03 April 2019 03:22
Use to_date to turn the string from the csv into a date.
Use to_char to turn it back into a string in the format forms wants.
How to use this function in this code?

unwilling or incapable to Read The Fine Manual yourself?

https://docs.oracle.com/database/121/SQLRF/functions216.htm#SQLRF06129
Previous Topic: FRM-50016 Legal Characters are 0-9 -+E Error Oracle Forms
Next Topic: error while getting more than values
Goto Forum:
  


Current Time: Mon Jun 01 21:45:10 CDT 2020