Home » Developer & Programmer » Forms » Manually Generating number (Windows XP Oracle 9i Dev 6i)
Manually Generating number [message #338862] Wed, 06 August 2008 02:31 Go to next message
*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 #338918 is a reply to message #338862] Wed, 06 August 2008 04:44 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is it a tricky question?

Because, it looks quite obvious - create a push button item, create a WHEN-BUTTON-PRESSED trigger and select next sequence value.
Re: Manually Generating number [message #338936 is a reply to message #338918] Wed, 06 August 2008 05:02 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
I tried before but not working thatz why i ask the question did you tried?

if anyone knows please let me know how to do?

Regards
Re: Manually Generating number [message #338955 is a reply to message #338936] Wed, 06 August 2008 05:33 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did I try? Yes, I did. And it works correctly.

/forum/fa/4740/0/
  • Attachment: seq_btn.PNG
    (Size: 17.42KB, Downloaded 1267 times)
Re: Manually Generating number [message #339298 is a reply to message #338862] Thu, 07 August 2008 04:24 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Thanks Little it worksssss......... Razz


Regards
Re: Manually Generating number [message #346843 is a reply to message #338955] Tue, 09 September 2008 18:49 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
hi,

I am trying to do a similar thing, but it gives me an error saying "Dual has to be declared". Can you help pls.

thank you
Re: Manually Generating number [message #346879 is a reply to message #346843] Wed, 10 September 2008 00:02 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Ooops! Could you, please, share the code you use? Possibly, copy and paste SQL*Plus session which looks like this:
SQL> select 'x' from dual;

'
-
x

SQL>

Because, if someone has dropped the DUAL table, I'm afraid that you are in very, very ... very deep sh*t (trouble, I mean).
Re: Manually Generating number [message #347127 is a reply to message #346879] Wed, 10 September 2008 17:16 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
Hi,

I tried this

SQL> select sysdate from dual;

SYSDATE
---------
10-SEP-08

SQL>

Re: Manually Generating number [message #347142 is a reply to message #347127] Wed, 10 September 2008 19:10 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
RD,

Fascinating observation. Does this mean that you have solved your problem or have not solved your problem?

David
Re: Manually Generating number [message #347425 is a reply to message #347142] Thu, 11 September 2008 10:51 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
Unfortunately No. I am still stuck with the same error
Re: Manually Generating number [message #347481 is a reply to message #347425] Thu, 11 September 2008 18:34 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you signed on to the database?

Is this your first form? Have you run the 'test' form?

David
Re: Manually Generating number [message #347483 is a reply to message #347481] Thu, 11 September 2008 18:53 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
Yes, I have signed on to the Database. The form was running well before I added this functionality.
Re: Manually Generating number [message #347484 is a reply to message #347483] Thu, 11 September 2008 18:59 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Show use EXACTLY what you have added. Cut and paste ALL of the code that you have added in your reply.

David
Re: Manually Generating number [message #347894 is a reply to message #347484] Sun, 14 September 2008 23:51 Go to previous messageGo to next message
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 #347945 is a reply to message #347894] Mon, 15 September 2008 02:46 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
At the bottom of the Oracle Forms Builder, Object Navigator there is Database Objects, click on the '+' sign, then click the '+' sign on 'SYS', then click the '+' sign on 'Tables'. Can you see 'dual' in the list (between 'dir$victim_policy' and 'duc$')?

David
Re: Manually Generating number [message #348077 is a reply to message #347945] Mon, 15 September 2008 09:54 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
Hi David,

I can see the dual table. It's placed between 'AW$EXPRESS' and 'ODCI_SECOBJ$'

thank you
Deepti
Re: Manually Generating number [message #348172 is a reply to message #348077] Mon, 15 September 2008 19:35 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
For the second time: "Show use EXACTLY what you have added. Cut and paste ALL of the code that you have added in your reply."

David
Re: Manually Generating number [message #348221 is a reply to message #348172] Tue, 16 September 2008 01:22 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

try

select bookno_seq.nextval into :books.sr_no from SYS.dual;


Re: Manually Generating number [message #348386 is a reply to message #348221] Tue, 16 September 2008 10:35 Go to previous messageGo to next message
former
Messages: 15
Registered: June 2008
Junior Member
Hi Mudabbir,

I tried your suggestion. It works perfectly. Great. Thanks a ton. Will get back if I get stuck again.

Cheers
Deepti
Re: Manually Generating number [message #348420 is a reply to message #348386] Tue, 16 September 2008 12:34 Go to previous message
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.
Previous Topic: How to use the host command to send mail in Forms 6i through PLSQL
Next Topic: Host command Help?
Goto Forum:
  


Current Time: Thu Dec 05 08:01:06 CST 2024