Table update through Form [message #358249] |
Mon, 10 November 2008 05:49 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sunidhi
Messages: 36 Registered: January 2006 Location: New Delhi
|
Member |
|
|
Dear All,
I want to update table ( a field) through form, While running query from sql prompt is running fine.But applying same query in ON-VALIDATE-FIELD through form gives error (PL/SQL Error : 103)
Query :-
declare
v varchar2(1);
begin
if to_char(sysdate,'mm') - to_char(to_date('pchdt','dd-mon-yyyy'),'mm') > 0
then
update mchalhd
set pflag = 'v' /* update with this field */
where pchdiv = 2 and pchdpno = :pchdpno;
end if;
end;
**********************************************
Gives Error :-
Encountered symbol "V" when expecting one of the following
".","(",")","*","%","|","is null" etc ...
Fatal syntax error, unable to recover before the end of file.
Kindly help me how to get rid of this error.
Regards,
Sunidhi
|
|
|
|
Re: Table update through Form [message #358260 is a reply to message #358255] |
Mon, 10 November 2008 06:29 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sunidhi
Messages: 36 Registered: January 2006 Location: New Delhi
|
Member |
|
|
Hi Liitlefoot,
Thx for your reply.
Actually I put v varchar2(1) becoz it is not accepting pflag = 'v' directlyAnd I put pchdt in single quotes as it is date field.Simply, I just need to update a field in a table if the stated condition is true.Kindly help me as I m new to Oracle.In case if there is any other easy way out to solve this problem.
Regards,
Sunidhi
|
|
|
Re: Table update through Form [message #358263 is a reply to message #358260] |
Mon, 10 November 2008 06:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote: | I put v varchar2(1) becoz it is not accepting pflag = 'v' directly
| But, variable declaration has nothing to do with the 'v' string in the UPDATE clause! These are NOT THE SAME!
Quote: | And I put pchdt in single quotes as it is date field
| Another nonsense; 'pchdt' in single quotes is a CHARACTER STRING, not a date.
Please, post SQL*Plus session which proves that this piece of code runs correctly.
|
|
|