how deal with primary key while using for loop in forms 6i [message #586061] |
Mon, 03 June 2013 03:54 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/71e7ed14bc76446bef38666d8e833174?s=64&d=mm&r=g) |
sameer_da
Messages: 74 Registered: April 2013 Location: India
|
Member |
|
|
Hii every one,
I am having template table as
template_name varchar2(100) -- primaykey
ex_col varchar2(100)
tab_col varchar2(100)
Now on the form 6i i've two columns with following data
Column A Column2 B
-------------------------------------
route a_route
time a_time
id a_id
and a text field where the name of the template will be entered.
e.g
text filed - testing
In template table i want to insert above values, so template table will look like this
template_name ex_col tab_col
-----------------------------------------------------
testing route a_route
time a_time
id a_id
since tempate_name is primary key, i how should i construct for loop for insert.
Please help me.
[MERGED by LF]
[Updated on: Tue, 04 June 2013 04:04] by Moderator Report message to a moderator
|
|
|
Re: how deal with primary key while using for loop in forms 6i [message #586063 is a reply to message #586061] |
Mon, 03 June 2013 04:15 ![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) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
You can't, not that way.
Two options I can think of: alter your "templates" table and either add a new primary key column (a number sequence is a candidate), or add another column into the primary key constraint (so it'll become a composite key) (for example, make TEMPLATE_NAME + EX_COL a primary key combination).
Another option is redesign: create another table which contains information about templates. Then, in your current "template" table, TEMPLATE_NAME won't be a primary but foreign key (pointing to a new "template" table). Current "template" table will have to be altered in order to store a primary key value. Here's an example:SQL> create table my_templates
2 (id_template number constraint pk_mytempl primary key,
3 template_name varchar2(100)
4 );
Table created.
SQL> create table template
2 (id_templ number constraint pk_templ primary key,
3 id_template number constraint fk_templ
4 references my_templates (id_template),
5 ex_col varchar2(100),
6 tab_col varchar2(100)
7 );
Table created.
SQL>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: lov and cursor problem [message #586525 is a reply to message #586519] |
Fri, 07 June 2013 03:45 ![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) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
which block is the cursor in when the form starts up?
Are you getting any errors?
If you execute the query with the standard button after the form starts does it work?
|
|
|
|
|
|
|
|
|
Re: lov and cursor problem [message #586558 is a reply to message #586556] |
Fri, 07 June 2013 06:48 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The suggestion remains the same - redesign the form to match the table structure.
Can you do it with a cursor - yes.
Will it be more work than redesigning the form to work with forms default functionality - almost certainly.
Is it more likely to have bugs than if you redesign the form - almost certainly.
Is it going to make maintaining the form harder going forward - almost certainly.
|
|
|