How to copy values from one table to another using WHEN-BUTTON-PRESSED trigger? [message #577309] |
Thu, 14 February 2013 03:21 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
I have two tables one is
1)create table abc(c_name varchar2(10),c_number number(6),c_loc varchar2(8)); --having values
2)create table temp(sname varchar2(10),sid number(4),address varchar2(10));---no having
and my question is how to insert a values into temp using when-button-pressed trigger based on abc table in oracle form
please please help me....
[EDITED by LF: split the message from an unrelated topic. Applied [code] tags]
[Updated on: Thu, 14 February 2013 03:34] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: How to copy values from one table to another using WHEN-BUTTON-PRESSED trigger? [message #577603 is a reply to message #577599] |
Tue, 19 February 2013 01:04 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Here i have a table with values:
--->create table abc(empno number(6),ename varchar2(10),sal number(8,2),selected_flag char(4));
insert into abc values(&empno,'&ename',&sal,NULL);
SELECT * FROM ABC;
--->CREATE TABLE TEMP(SNO NUMBER(6),SNAME VARCHAR2(10),LOC VARCHAR2(10));---->no values
SELECT * FROM TEMP;
And my query is that inserted values with the help of already inserted table , when only checked check boxes
DECLARE
v_message varchar2(10);
v_empno number(6);
r_rec cur1%type;
cursor cur1 is select * from abc where empno=v_empno;
BEGIN
v_message:=('insert into temp table');
for r_rec in cur1 loop
if :abc.selected_flag is not null then
insert into abc values(r_rec.empno,r_rec.ename,r_rec.sal,r_rec.selected_flag);
end if;
end loop;
close cur1;
commit;
end;
|
|
|
|
Re: How to copy values from one table to another using WHEN-BUTTON-PRESSED trigger? [message #577606 is a reply to message #577604] |
Tue, 19 February 2013 01:15 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Clean up that code first. - What is V_EMPNO used for? Where does it get its value?
- What is ":abc.selected_flag"? If it is a checkbox, it can't be null as it has to have some value (Y or N, 1 or 0, whatever) so testing whether it is NULL or not is useless. Besides, you'd rather use CHECKBOX_CHECKED built-in.
- Are you sure you want to insert into ABC again? You said that it contains data, but TEMP is empty. As your code suggests different, I'm somewhat confused.
[Updated on: Tue, 19 February 2013 01:15] Report message to a moderator
|
|
|
|
|
Re: How to copy values from one table to another using WHEN-BUTTON-PRESSED trigger? [message #577666 is a reply to message #577618] |
Tue, 19 February 2013 08:25 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
sivasurya wrote on Tue, 19 February 2013 03:52No sir,
i want insert values into empty temp table through abc table using when-button-pressed-trigger
There is no empty temp table in your code. The code and table is different from the original question. What is this mess you keep posting? Why don't you take some time and a question properly with things clearly described. You surely have not done that as of yet.
|
|
|
|