Home » Developer & Programmer » Forms » Error is FRM-50012 date format
Error is FRM-50012 date format [message #614965] Thu, 29 May 2014 03:56 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi,

I have to database fields . A and B both of them Datatype is Date.
In oracle Forms 6i Format is Day when I enter day Friday it is not Accepting. Error is FRM-50012 date format must be like Day.
please tell me how to solve this issue.

Thanks
Re: Error is FRM-50012 date format [message #614968 is a reply to message #614965] Thu, 29 May 2014 04:05 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
I have written the below in the when-validate_item on hiredate item(database)

declare
	--DAY date:=to_char(to_date(sysdate,'dd/mm/yyyy'), 'Day');
	DAY date;
begin
set_item_property(:EMP.HIREDATE,format_mask,DAY);
end;


Please suggest..
Re: Error is FRM-50012 date format [message #614972 is a reply to message #614968] Thu, 29 May 2014 04:26 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
That's equivalent to:
set_item_property(:EMP.HIREDATE,format_mask,null);


A date variable != a valid format mask.
Re: Error is FRM-50012 date format [message #614973 is a reply to message #614972] Thu, 29 May 2014 04:30 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
A date variable != a valid format mask.

Yes
when-validate-item
-----------------
declare
   v_date date;
begin
  IF :System.Mode = 'ENTER-QUERY' THEN
     select to_char(to_date(hiredate,'dd/mm/yyyy'), 'Day')
       into v_date
       from emp
      where empno=7369;
    set_item_property(:EMP.HIREDATE,format_mask,v_date);
  end if;
end;


For sample purpose i made some changes and can you please help how to do this?
Re: Error is FRM-50012 date format [message #614978 is a reply to message #614973] Thu, 29 May 2014 04:48 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
I have no idea what you're trying to do because what you've posted so far makes no sense.

1) is hiredate actually varchar in your DB, or is it a date? Because if it's date (which it should be) then that to_Date shouldn't be there.
2) Dates do not have formats. repeat that 10 times. Then read this: http://edstevensdba.wordpress.com/category/nls_date_format/
then repeat it a few more times.
v_date is a date, it will not hold data in the Day format, because like all dates it doesn't hold the data in any recognizable format. If you want to store a date in a particular format you need to put it in a varchar.
3) Assuming v_date was a varchar it would hold a value like 'Thursday'. 'Thursday' is not a valid format mask.
Re: Error is FRM-50012 date format [message #614981 is a reply to message #614972] Thu, 29 May 2014 04:48 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi cookiemonster please help me on this...i am really very thankful to you..
Re: Error is FRM-50012 date format [message #614984 is a reply to message #614981] Thu, 29 May 2014 04:50 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
stop being impatient. I have other things to do besides helping you.
Re: Error is FRM-50012 date format [message #614986 is a reply to message #614984] Thu, 29 May 2014 04:56 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
3) Assuming v_date was a varchar it would hold a value like 'Thursday'. 'Thursday' is not a valid format mask.


Yes you are right, but how can do this ?

In the table Hiredate is the DATE Datatype

Thanks
Re: Error is FRM-50012 date format [message #614989 is a reply to message #614978] Thu, 29 May 2014 05:09 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Thu, 29 May 2014 10:48
I have no idea what you're trying to do because what you've posted so far makes no sense.


You need to explain what you want in words, rather than meaningless code.

Re: Error is FRM-50012 date format [message #614991 is a reply to message #614989] Thu, 29 May 2014 05:13 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Thanks cookiemonster, i want to display the Day name like Thursday instead of the date (dd-mon-yyyy) format...
Re: Error is FRM-50012 date format [message #614992 is a reply to message #614991] Thu, 29 May 2014 05:19 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
So set the format mask of the field to Day.
Re: Error is FRM-50012 date format [message #614994 is a reply to message #614992] Thu, 29 May 2014 05:30 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
So set the format mask of the field to Day.

1) click on the enter-query mode
2)pass hiredate as Friday
3)then click on the execute-query

i am getting frm-40358 invalid date in example record
Re: Error is FRM-50012 date format [message #614998 is a reply to message #614994] Thu, 29 May 2014 05:47 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
Are you trying to modify the form so that if you enter Friday it returns all records where the hiredate is a Friday?
Re: Error is FRM-50012 date format [message #615000 is a reply to message #614998] Thu, 29 May 2014 05:51 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
Are you trying to modify the form so that if you enter Friday it returns all records where the hiredate is a Friday?


I passed all the days from Sunday to Sat but same error..

I do have just given sample process , but in my Block Day1 and Day2 are the 2 Database Date datatype columns.


Re: Error is FRM-50012 date format [message #615003 is a reply to message #615000] Thu, 29 May 2014 06:06 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
That doesn't answer my question.
Re: Error is FRM-50012 date format [message #615012 is a reply to message #615003] Thu, 29 May 2014 07:36 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
If the format mask of the item is set to 'Day', which is not what the code above does, then you should be able to enter a day of the week into the field. However, even with the mask set to Day a date is still a date, so if you enter Thursday, the date item will be set to a particular Thursday, and probably not the one you want:
SQL> SELECT to_char(to_date('Thursday', 'Day'), 'DD-MON-YYYY') FROM dual;
 
TO_CHAR(TO_DATE('THURSDAY','DA
---------------------------------------------------------------------------
01-MAY-2014

Re: Error is FRM-50012 date format [message #615074 is a reply to message #615012] Fri, 30 May 2014 00:27 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:

If the format mask of the item is set to 'Day', which is not what the code above does, then you should be able to enter a day of the week into the field. However, even with the mask set to Day a date is still a date, so if you enter Thursday, the date item will be set to a particular Thursday, and probably not the one you want:

Yes , you are right cookiemonster, what is the process to resolve this problem suggest me please
Re: Error is FRM-50012 date format [message #615090 is a reply to message #615074] Fri, 30 May 2014 02:54 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
You still haven't told me what you want the code to actually do.
Re: Error is FRM-50012 date format [message #615115 is a reply to message #615090] Fri, 30 May 2014 06:52 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
You still haven't told me what you want the code to actually do.

In my code in the into clause it displays the date as Days like 'Sunday', "Monday...etc"

And the below code set_item_property(:EMP.HIREDATE,format_mask,v_date);

Sets the date as in Days..

And i am really sory for the lately reply...
Re: Error is FRM-50012 date format [message #615118 is a reply to message #615115] Fri, 30 May 2014 07:01 Go to previous messageGo to next message
cookiemonster
Messages: 13921
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why are you trying to have the date in format? What is the point of it?
You've repeated told me you want the date in day format. I've told you why your existing code doesn't work, I've told you how to do it, and I've pointed out that just entering a day will probably give a date you don't expect.
You've acknowledged that this last point is problem for what you are trying to achieve, but you still haven't actually told me what you are trying to achieve, beyond just having the fields in Day format. I can't suggest a solution until you explain the purpose of using Day.

I did ask if you were using Day for one particular reason above and your response seemed to have nothing to do with what I asked.
Re: Error is FRM-50012 date format [message #615190 is a reply to message #615118] Sat, 31 May 2014 03:17 Go to previous message
hamandi_143
Messages: 4
Registered: January 2014
Location: Bahrain
Junior Member
Dear

this command will help

select to_char(sysdate,'day') from dual;


Best Regards
Hamad
Previous Topic: How to run URL www.google.com in OLE
Next Topic: formsweb.cfg testmode=false
Goto Forum:
  


Current Time: Thu May 02 07:10:24 CDT 2024