Home » Developer & Programmer » Forms » form prob
form prob [message #331921] |
Sun, 06 July 2008 10:55 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
acma
Messages: 20 Registered: July 2008 Location: mauritania
|
Junior Member |
![ahmedcheinane](/forum/theme/orafaq/images/skype.png)
|
|
Hi everyone,
I wanna feed a table from another, but in the target table i will have the date both before and after update.
clearly: origin_tbl(ID, ref, posi)
target_tbl(id, a_ref,a_posi, ref, posi)
so, i tried to initialize the the target table ( a_ref:=origin_tbl.ref,a_posi:=origin_tbl.posi)
and i update th target table after the field update.
but i tried to insert into the target table with both pre-update and when-new-instance-block, but wasn't ok.
i hpe my problem is clear now .
thanks previously..
|
|
|
|
|
|
Re: form prob [message #332550 is a reply to message #332334] |
Tue, 08 July 2008 23:34 ![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) |
ora_baby
Messages: 89 Registered: May 2008
|
Member |
|
|
hi
try trigger WHEN-NEW-ITEM-INSTANCE or POST_CHANGE
{sorry for my mistake, becose i'm lerning english. Please, correct me if i don't right}
|
|
|
|
Re: form prob [message #332687 is a reply to message #332655] |
Wed, 09 July 2008 06:39 ![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) |
|
I would suggest you to use the POST-UPDATE trigger. The difference is .. the On-Update trigger works without commit being really applied. which means only when the block is marked for update the trigger fires. The POST-UPDATE trigger will fire after the commit has been applied for the update.
|
|
|
|
Re: form prob [message #333096 is a reply to message #331921] |
Thu, 10 July 2008 09:01 ![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) |
Kaeluan
Messages: 179 Registered: May 2005 Location: Montreal, Quebec
|
Senior Member |
|
|
get_item_property is a form built-in, you don`t have to declare it anywhere. You can check your form builder documentation on how to use it.
|
|
|
|
Re: form prob [message #333758 is a reply to message #333757] |
Mon, 14 July 2008 06:49 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
The error is clear, isn't it? You cannot use get_item_property in a SQL-statement.
So, pull it out of the SQL and use an intermediate variable.
|
|
|
Re: form prob [message #333760 is a reply to message #331921] |
Mon, 14 July 2008 06:51 ![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) |
Kaeluan
Messages: 179 Registered: May 2005 Location: Montreal, Quebec
|
Senior Member |
|
|
Just assign it before using it in your sql.
something like
v_temp := get_item_property(...);
insert into ...
values (...,v_temp,...);
|
|
|
|
Re: form prob [message #333842 is a reply to message #331921] |
Mon, 14 July 2008 10:01 ![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) |
Kaeluan
Messages: 179 Registered: May 2005 Location: Montreal, Quebec
|
Senior Member |
|
|
You forgot the quote in your get_item_property command. If you check the documentation, first parameter is a varchar.
Try something like this
v_temp AGENT.DATNAT%TYPE := Get_Item_Property('BAGENT.DATNAT1',Database_Value);
|
|
|
|
Re: form prob [message #333847 is a reply to message #331921] |
Mon, 14 July 2008 10:30 ![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) |
Kaeluan
Messages: 179 Registered: May 2005 Location: Montreal, Quebec
|
Senior Member |
|
|
I don't know if it can make a difference, but what version of forms you are using?
I just tried it in Forms 10g and i got no compilation error.
Here is what i tried
declare
v_temp gav_utl_vehicule.prdass_id%type := get_item_property('gav_utl_veh.prdass_id',Database_value);
begin
null;
end;
|
|
|
|
|
|
Re: form prob [message #334144 is a reply to message #334109] |
Tue, 15 July 2008 09:27 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
You say you changed your code, but now nothing gets inserted.
So I say: show us your new code. How else can we help you?
Post it here, enclose it with [code] and [/code] tags.
|
|
|
Re: form prob [message #334159 is a reply to message #334144] |
Tue, 15 July 2008 10:17 ![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) |
acma
Messages: 20 Registered: July 2008 Location: mauritania
|
Junior Member |
![ahmedcheinane](/forum/theme/orafaq/images/skype.png)
|
|
declare
v_temp0 AGENT.DATNAT%TYPE := Get_Item_Property('BAGENT.DATNAT1',Database_Value);
v_temp1 AGENT.DTRECR%TYPE := Get_Item_Property('BAGENT.DTRECR1',Database_Value);
v_temp2 AGENT.CDCLAS%TYPE := Get_Item_Property('BAGENT.CDCLAS1',Database_Value);
v_temp3 AGENT.ECHLON%TYPE := Get_Item_Property('BAGENT.ECHLON1',Database_Value);
v_temp4 AGENT.CDPOSI%TYPE := Get_Item_Property('BAGENT.CDPOSI',Database_Value);
v_temp5 AGENT.DTPOSI%TYPE := Get_Item_Property('BAGENT.DTPOSI1',Database_Value);
begin
-- Code Piéce 2000
IF :BAGENT.DATNAT1=Get_Item_Property(:BAGENT.DATNAT1,Database_Value) Then
--Champ Non Modifié
null;
Else --Champ Modifié
INSERT INTO proto_agent_fp VALUES('2000',
:IDENT.MATRIC,
:BAGENT.REFNAT1,
:BAGENT.DATNAT1,
:IDENT.SEXEAG,
:IDENT.DTNAIS,
:IDENT.NOMAGL,
:IDENT.SITFAM,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.DATECH1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
:BAGENT.DTRECR1,
v_temp0,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
'15/12/2007',
0,
0,
'12345',
'15/12/2008',
0,
'15/12/2006');
end IF;
--
IF :BAGENT.DTRECR1=Get_Item_Property(:BAGENT.DTRECR1,Database_Value) Then
--Champ Non Modifié
null;
Else --Champ Modifié
INSERT INTO proto_agent_fp VALUES('2000',
:IDENT.MATRIC,
:BAGENT.REFNAT1,
:BAGENT.DATNAT1,
:IDENT.SEXEAG,
:IDENT.DTNAIS,
:IDENT.NOMAGL,
:IDENT.SITFAM,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.DATECH1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
v_temp1,
BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
'15/12/2007',
0,
0,
'12345',
'15/12/2008',
0,
'15/12/2006');
end IF;
-- --
-- Code Piéce 2015
-- --
IF :BAGENT.CDCLAS1=Get_Item_Property(:BAGENT.CDCLAS1,Database_Value)Then
--Champ Non Modifié
null;
Else --Champ Modifié
INSERT INTO proto_agent_fp VALUES('2015',
:IDENT.MATRIC,
:BAGENT.RFCLGR1,
:BAGENT.DTCLGR1,
:IDENT.SEXEAG,
:IDENT.DTNAIS,
:IDENT.NOMAGL,
:IDENT.SITFAM,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.DATECH1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
v_temp2,
:BAGENT.ECHLON1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
'15/12/2007',
0,
0,
'12345',
'15/12/2008',
0,
'15/12/2006');
end IF;
IF :BAGENT.ECHLON1=Get_Item_Property(:BAGENT.ECHLON1,Database_Value) Then
--Champ Non Modifié
null;
Else --Champ Modifié
INSERT INTO proto_agent_fp VALUES('2015',
:IDENT.MATRIC,
:BAGENT.REFECH1,
:BAGENT.DATECH1,
:IDENT.SEXEAG,
:IDENT.DTNAIS,
:IDENT.NOMAGL,
:IDENT.SITFAM,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.DATECH1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
v_temp3,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI,
'15/12/2007',
0,
0,
'12345',
'15/12/2008',
0,
'15/12/2006');
end IF;
-- Code Piéce 2021
IF :BAGENT.CDPOSI=Get_Item_Property(:BAGENT.CDPOSI,Database_Value) Then
--Champ Non Modifié
null;
Else --Champ Modifié
INSERT INTO proto_agent_fp VALUES('2021',
:IDENT.MATRIC,
:BAGENT.RFPOSI1,
:BAGENT.DTPOSI1,
:IDENT.SEXEAG,
:IDENT.DTNAIS,
:IDENT.NOMAGL,
:IDENT.SITFAM,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
:BAGENT.DATECH1,
:BAGENT.CDPOSI,
:BAGENT.DTPOSI1,
:BAGENT.DTRECR1,
:BAGENT.DATNAT1,
:BAGENT.CDCOEM,
:BAGENT.CDCLAS1,
:BAGENT.ECHLON1,
v_temp4,
v_temp5,
'15/12/2007',
0,
0,
'12345',
'15/12/2008',
0,
'15/12/2006');
end IF;
exception
WHEN OTHERS THEN
NULL;
end;
|
|
|
Re: form prob [message #334173 is a reply to message #334159] |
Tue, 15 July 2008 12:04 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Quote: | exception
WHEN OTHERS THEN
NULL;
end;
|
Who taught you that?
Why is that there?
Can you, before you do ANYTHING else, explain to us in very much detail what this piece of code actually does? (by "this piece of code", I mean the quoted exception-handler)
I mean it, I am very serious. Think and explain what YOU think this does.
After you did we will tell you the Big Truth.
[Updated on: Tue, 15 July 2008 12:05] Report message to a moderator
|
|
|
Re: form prob [message #334375 is a reply to message #334173] |
Wed, 16 July 2008 05:57 ![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) |
acma
Messages: 20 Registered: July 2008 Location: mauritania
|
Junior Member |
![ahmedcheinane](/forum/theme/orafaq/images/skype.png)
|
|
Thank for taking care of my problem..
As i understand it, this piece of code work if any error happened in the insert above.
And i am waiting for the "BIG TRUTH".
As you saw,I am biggener in both Oracle and English.
[Updated on: Wed, 16 July 2008 05:58] Report message to a moderator
|
|
|
Re: form prob [message #334392 is a reply to message #334375] |
Wed, 16 July 2008 06:33 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
The exception handler will execute the code within, whenever ANY error occurs, not just with the insert, but ANY exception.
The code within is "NULL;", so guess what happens if you run into an error, ANY error...
It will just silently go on with the calling code.
When others is used wrongly in about 100% of the cases I see here at OraFAQ.
There's your Big Truth: Do not use when others until you understand why I tell you not to use it.
|
|
|
|
Re: form prob [message #334428 is a reply to message #331921] |
Wed, 16 July 2008 07:53 ![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) |
Kaeluan
Messages: 179 Registered: May 2005 Location: Montreal, Quebec
|
Senior Member |
|
|
Are you sure your trigger is executed?
Maybe you should put some trace in it to see what part of code is executed.
Tu put trace in your form use the following command:
message('Some Message here');
This will help you to debug your code.
|
|
|
|
Re: form prob [message #334472 is a reply to message #334424] |
Wed, 16 July 2008 12:07 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
acma wrote on Wed, 16 July 2008 14:46 | but no thing happens
|
Define "nothing". Does your cursor change into an hourglass?
Does your application hang? Do any messages that you added popup?
Which part of your code gets executed?
"Nothing happens" is what an end-user says, not what a developer says. (ok, unless really really really nothing happens, which is rarely the case)
|
|
|
|
|
|
Re: form prob [message #334732 is a reply to message #334637] |
Thu, 17 July 2008 15:28 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
No I won't
I have access to exactly the same (if not less, I have no hardcopies) documentation as you.
Time to do some research yourself. The assignment is quite easy: what's the difference between POST-UPDATE and POST-CHANGE.
What really baffles me is that you were about to switch from one to the other, apparently without even the slightest idea of what each does..
|
|
|
|
Re: form prob [message #335064 is a reply to message #335052] |
Sun, 20 July 2008 11:40 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
If you say so, then it is. (anyway, that sounds more logical then a post-change)
Now did the fact that you found this yourself and that you now know and understand the difference between the two give far more satisfaction then when I simply told you which to use?
If you try to find out things by yourself, then
a) you will learn how to search
b) it is far less likely you will forget what you found.
Now, enjoy what you got and get back with any questions you may come up with.
(But remember to try to find the answers yourself first! And to assure yourself of better answers from the people here, tell us what you did to try to get to the answer)
|
|
|
|
Re: form prob [message #335214 is a reply to message #335202] |
Mon, 21 July 2008 08:35 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Excerpt from your code | v_temp0 AGENT.DATNAT%TYPE := Get_Item_Property('BAGENT.DATNAT1',Database_Value);
...
IF :BAGENT.DATNAT1=Get_Item_Property(:BAGENT.DATNAT1,Database_Value)
|
I see a difference there. Why is that?
|
|
|
|
Re: form prob [message #335255 is a reply to message #335214] |
Mon, 21 July 2008 11:28 ![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) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Frank wrote on Mon, 21 July 2008 15:35 | Excerpt from your code | v_temp0 AGENT.DATNAT%TYPE := Get_Item_Property('BAGENT.DATNAT1',Database_Value);
...
IF :BAGENT.DATNAT1=Get_Item_Property(:BAGENT.DATNAT1,Database_Value)
|
I see a difference there. Why is that?
|
Reread what I say, not what you think I say.
I did not ask you why you duplicated it, I asked you why the two were different.
|
|
|
Re: form prob [message #335981 is a reply to message #335255] |
Thu, 24 July 2008 05:30 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
acma
Messages: 20 Registered: July 2008 Location: mauritania
|
Junior Member |
![ahmedcheinane](/forum/theme/orafaq/images/skype.png)
|
|
OHH, shut!
So sorry Mister Frank,
I think you mean that i should write it like this :v_temp0 AGENT.DATNAT%TYPE := Get_Item_Property('BAGENT.DATNAT1',Database_Value);
...
IF :BAGENT.DATNAT1=Get_Item_Property('BAGENT.DATNAT1',Database_Value)
this one was corrected in my code, just didnt take attention in the comments.
|
|
|
Goto Forum:
Current Time: Sun Feb 09 07:20:38 CST 2025
|