Manually Generating number [message #338862] |
Wed, 06 August 2008 02:31 |
*munnabhai*
Messages: 157 Registered: March 2008 Location: Riyadh
|
Senior Member |
|
|
Hi Guyz,
I have written the sequence code on the below trigger for generating sequence number
Trigger Name : Pre - Insert
select myseq.nextval into :vendor.vendor_id
rom vendor;
is there anyway to generate these number manually? i want to generate the sequences on when button pressed?
Regards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Manually Generating number [message #347894 is a reply to message #347484] |
Sun, 14 September 2008 23:51 |
former
Messages: 15 Registered: June 2008
|
Junior Member |
|
|
I have a created a form which is is based on a database of books. Here, the user gets to add books while running the form (dynamically). However, I would like the serial no of each record to get updated i.e. whenever a new record (book details) is inserted, the sr_no should be automatically generated in the database.
I have given a Pre-Insert Trigger at block level as follows:
select bookno_seq.nextval into :books.sr_no from dual;
However, I am getting these errors
"Error 201...........identifier 'dual' must be declared"
"Error 0..............SQL statement ignored"
thank you
Deepti
|
|
|
|
|
|
|
|
Re: Manually Generating number [message #348420 is a reply to message #348386] |
Tue, 16 September 2008 12:34 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Before going on, would you, please, mind to execute the following query (connected as a privileged user (SYS)); the result should be as displayed:SQL> col owner format a15
SQL> col synonym_name format a15
SQL> col table_owner format a15
SQL> col table_name format a15
SQL> col db_link format a10
SQL>
SQL> select * from all_synonyms where synonym_name = 'DUAL';
OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME DB_LINK
--------------- --------------- --------------- --------------- ----------
PUBLIC DUAL SYS DUAL
SQL>
If query returns nothing, try the following:SQL> create public synonym dual for sys.dual; Go back to the form, remove "sys." from the query and try to compile the trigger again.
Because, it sounds as if someone has dropped the public synonym (but, as GRANT has remained, you were able to use DUAL when you have specified owner (as "sys.dual")).
However, if that's not the case, nothing else comes on my mind at the moment.
|
|
|