Home » Developer & Programmer » Forms » Table update through Form (Oracle 7.3, Unix)
Table update through Form [message #358249] Mon, 10 November 2008 05:49 Go to next message
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 #358255 is a reply to message #358249] Mon, 10 November 2008 06:22 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Which "v" does your form not like? Is it this one:
v varchar2(1);
or this one
set pflag = 'v' /* update with this field */
Both of them look all right to me, so ... hm, perhaps you didn't show us the real code.

Why? Because, why did you declare the "v" variable and never used it? Also, why did you enclose "pchdt" into single quotes in
to_char(to_date('pchdt','dd-mon-yyyy'),'mm')

So, how about posting the form trigger code once again?
Re: Table update through Form [message #358260 is a reply to message #358255] Mon, 10 November 2008 06:29 Go to previous messageGo to next message
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
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.
Previous Topic: Flashing Lights
Next Topic: Letters Reports in 10g
Goto Forum:
  


Current Time: Sun Feb 09 09:07:03 CST 2025