Home » Developer & Programmer » Forms » save trigger not working
save trigger not working [message #414481] Wed, 22 July 2009 05:54 Go to next message
simcky
Messages: 38
Registered: July 2009
Member
hii
i had made a form using datablock wizard
and the structure of table which i used is as follows:-
Describing prtrmsg....
NAME                            Null?     Type
------------------------------- --------- -----
EMPNO                           NOT NULL  VARCHAR2(8)
STARTPAYPERIOD                  NOT NULL  VARCHAR2(6)
ENDPAYPERIOD                              VARCHAR2(6)
MESSAGE1                                  VARCHAR2(38)
MESSAGE2                                  VARCHAR2(47)
MESSAGE3                                  VARCHAR2(47)
MESSAGE4                                  VARCHAR2(47)


i have two blocks in the form
1)prtrmsg in which i have item's empno
to populate the empno item i had made a lov using emp table and using record grp query as select distinct empno from emp;
2)prtrmsg1 in which i have item's empno,startpayperiod,endpayperiod,message1,message2,message3,
message 4

and i had created master-detail relation using the where condition
prtrmsg.empno=prtrmsg1.empno

and in form i had placed a push button on which i m writting the
when-button-pressed trigger
if :system.form_status='changed' then 
   commit_form;
end if;

when i clicking on the push button i m not getting any result could someone please help me out to remove this problem

[EDITED by LF: applied [code] tags]

[Updated on: Wed, 22 July 2009 06:08] by Moderator

Report message to a moderator

Re: save trigger not working [message #414484 is a reply to message #414481] Wed, 22 July 2009 06:07 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This
if
:system.form_status='changed'
then
wasn't true so nothing has happened. Also, I believe that system variables' values are case sensitive (so perhaps you should try with 'CHANGED' instead of 'changed').
Re: save trigger not working [message #414492 is a reply to message #414484] Wed, 22 July 2009 06:22 Go to previous messageGo to next message
simcky
Messages: 38
Registered: July 2009
Member
thanks for the help sir.

but when i replaced the changed with CHANGED
and then clicked then button
then i get an error i.e
FRM-40508:ORACLE error:unable to INSERT record

and when i m pressing shift+f1 to get more about the error
then i m getting a database error window
which has the following explanation:-

SQL statement in error :
INSERT INTO PRTRMSG(EMPNO,ITEM5) VALUES (:1,:2)
Error:ORA-00904: invalid column name

could you please help me out
Re: save trigger not working [message #414495 is a reply to message #414492] Wed, 22 July 2009 06:27 Go to previous messageGo to next message
simcky
Messages: 38
Registered: July 2009
Member
sorry i forgot to tell that in my first block
i have empno item
and one more text item
which is used to display the empname
the lov i m using to populate these item is based on the record grp query as
select empno,empname
from prmaemp
Re: save trigger not working [message #414512 is a reply to message #414492] Wed, 22 July 2009 07:21 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
INSERT INTO PRTRMSG(EMPNO,ITEM5) VALUES (:1,:2)
Error:ORA-00904: invalid column name

This should be fixed.
Re: save trigger not working [message #414514 is a reply to message #414492] Wed, 22 July 2009 07:23 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
simcky wrote on Wed, 22 July 2009 12:22

SQL statement in error :
INSERT INTO PRTRMSG(EMPNO,ITEM5) VALUES (:1,:2)
Error:ORA-00904: invalid column name



Seems fairly obvious - I doubt the table prtmsg contains a column called item5.
Try changing item5's database item property to No.
Re: save trigger not working [message #414618 is a reply to message #414514] Thu, 23 July 2009 00:12 Go to previous messageGo to next message
simcky
Messages: 38
Registered: July 2009
Member
Thanks for the help Mr.cookiemonster
but when i set the database property of item5 to no then again i m getting the same error FRM-40508:ORACLE error unable to insert record
and when i m pressing shift+f1
then i got
database error

sql statement in error:
INSERT INTO PRTRMSG(EMPNO) VALUES (:1)

Error:
ORA-01400: cannot insert NULL into ("NAV"."PRTRMSG"."STARTPAYPERIOD")

Where NAV is my database name.

please help me out to remove this problem
Re: save trigger not working [message #414622 is a reply to message #414618] Thu, 23 July 2009 00:36 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Do not try to insert NULL value (on the screen, it would be an empty "STARTPAYPERIOD" item) into a column which is declared as NOT NULL.
Re: save trigger not working [message #414624 is a reply to message #414622] Thu, 23 July 2009 00:50 Go to previous messageGo to next message
simcky
Messages: 38
Registered: July 2009
Member
Gudmorning Mr.Littlefoot

sir, i m not inserting null value to any not null column but then also i m getting this error
i m having only three not null item's :-empno,startpayperiod,endpayperiod
and i m giving value to all these columns

you can also see the attachment given below

please help me out to remove the problem....
  • Attachment: form.GIF
    (Size: 39.45KB, Downloaded 579 times)
Re: save trigger not working [message #414693 is a reply to message #414618] Thu, 23 July 2009 03:59 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
simcky wrote on Thu, 23 July 2009 06:12

sql statement in error:
INSERT INTO PRTRMSG(EMPNO) VALUES (:1)

Error:
ORA-01400: cannot insert NULL into ("NAV"."PRTRMSG"."STARTPAYPERIOD")




Well that insert is only supplying values for empno, so the error is predictable.

Have you got two blocks based on the same table?
Re: save trigger not working [message #414708 is a reply to message #414693] Thu, 23 July 2009 04:40 Go to previous messageGo to next message
simcky
Messages: 38
Registered: July 2009
Member
yaa

both of the blocks of my form are based on the prtrmsg table
Re: save trigger not working [message #414721 is a reply to message #414481] Thu, 23 July 2009 05:31 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
So the first block which only has empno is trying to do an insert and failing because it can't supply values for all the not null columns.
You need to make that first block a non database block or get rid of it entirely.
icon7.gif  Re: save trigger not working [message #414733 is a reply to message #414721] Thu, 23 July 2009 05:49 Go to previous message
simcky
Messages: 38
Registered: July 2009
Member
hey
Thanks Mr.cookiemonster my trigger is working properly now.
Previous Topic: Forms2XML
Next Topic: Radio_button for null values
Goto Forum:
  


Current Time: Fri Sep 20 09:39:27 CDT 2024