Home » Developer & Programmer » Forms » Create Trigger On Backend
Create Trigger On Backend [message #479013] Thu, 14 October 2010 04:41 Go to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

Hi friends,

I Created a form just for testing purpose [Which is i attached]
My Table is TEST0
Structure of table :
---------------------------
NO VARCHAR2(5)
NAME VARCHAR2(10)
FLG VARCHAR2(1)


My Task is When i added a record,
e.g if on form, i add name - AAD
But its must save on TEST0 Table like this way EMPAAD...means
always concate with 'EMP'||:Block.name while saving on database..

I know how to do with front end application, but i want to achieve this task by using trigger on backend databse...
so please help me how to create a Trigger on backend....i try a one trigger but it give me error- Unable to insert Record...

Please help to create trigger.....
  • Attachment: MODULE1.fmb
    (Size: 44.00KB, Downloaded 1047 times)
Re: Create Trigger On Backend [message #479020 is a reply to message #479013] Thu, 14 October 2010 04:56 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
SQL> create table test1
  2  (NO   VARCHAR2(5),
  3   NAME VARCHAR2(10),
  4   FLG  VARCHAR2(1)
  5  );

Table created.

SQL> create or replace trigger trg_test1
  2    before insert on test1
  3    for each row
  4  begin
  5    :new.name := 'EMP' || :new.name;
  6  end;
  7  /

Trigger created.

SQL> insert into test1 (no, name, flg) values ('A', 'Little', '1');

1 row created.

SQL> select * from test1;

NO    NAME       F
----- ---------- -
A     EMPLittle  1

SQL>
Re: Create Trigger On Backend [message #479023 is a reply to message #479020] Thu, 14 October 2010 05:12 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

Hi Littlefoot,

I exactly copy same trigger on backend....but while i add data from my front end oracle application form...data still not saved in database...what is eaxct problem
Re: Create Trigger On Backend [message #479024 is a reply to message #479023] Thu, 14 October 2010 05:16 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As form returns "Unable to insert record" error, go to Help menu (in Forms runtime window) and select "Display error". Paste the result back here.
Re: Create Trigger On Backend [message #479025 is a reply to message #479024] Thu, 14 October 2010 05:50 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

I have a doubt
I Created a trigger(When-Button-pressed) on add button :
commit;

I created a trigger on backend which mentioned u earlier..

I Want to ask execution flow ...that means when i press add button for save data in database, which one first fire...
Commit - On form level or Then trigger or vice versa..

Help me...to solve my doubt
Re: Create Trigger On Backend [message #479027 is a reply to message #479025] Thu, 14 October 2010 05:55 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Commit ends a transaction so - everything must be done before it.

(Where's the result of "Display error" window?)
Re: Create Trigger On Backend [message #479028 is a reply to message #479027] Thu, 14 October 2010 05:56 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

the problem is solved....
Re: Create Trigger On Backend [message #479029 is a reply to message #479028] Thu, 14 October 2010 05:57 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

thank you.............
Re: Create Trigger On Backend [message #479030 is a reply to message #479029] Thu, 14 October 2010 05:57 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Now I'm curious: what did you do to solve it?
Re: Create Trigger On Backend [message #479031 is a reply to message #479030] Thu, 14 October 2010 05:58 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

haha....i think i did mistake....
Re: Create Trigger On Backend [message #479032 is a reply to message #479031] Thu, 14 October 2010 06:11 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What was it? Not that I'll feel better if I knew, but someone who bumps into this thread searching for solution for his/her error might benefit from your experience.
Re: Create Trigger On Backend [message #479033 is a reply to message #479032] Thu, 14 October 2010 06:20 Go to previous messageGo to next message
swapnil_naik
Messages: 269
Registered: December 2009
Location: Mumbai
Senior Member

Its silly mistake i did....
i opened 2-3 console at a time, so i used old console to check it data...

sorry for taking your time...

Thanks you...
Re: Create Trigger On Backend [message #479038 is a reply to message #479033] Thu, 14 October 2010 06:45 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I see; thank you for the feedback.
Previous Topic: Pre-query vs post-quey
Next Topic: pb oracle9ias entrepise edition + forms6i
Goto Forum:
  


Current Time: Thu Sep 19 17:15:41 CDT 2024