Call a procedure [message #310177] |
Mon, 31 March 2008 08:29  |
bluerratiq
Messages: 22 Registered: March 2008 Location: Bucharest
|
Junior Member |
|
|
Hello,
I am trying to create an application something like a library administration.
I have some difficulties when I am trying to insert some records. I've created a procedure which inserts only distinct author names (for the books) and I am trying to call the procedure when a button is pressed. Also I want to use substitution variables.
While running it from Toad, works fine, but in Forms I can figure it out why it doesn't work .. the plsql code doesnt compile.
This is the procedure:
PROCEDURE InsertAutor IS
POET VARCHAR2(50);
ESTE NUMBER;
BEGIN
SELECT COUNT(*)
INTO ESTE
FROM AUTOR WHERE NUME_AUTOR=POET;
IF ESTE=0 THEN INSERT INTO AUTOR(NUME_AUTOR) VALUES(POET);
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN ROLLBACK;
END;
In Toad I used to: call InsertAutor('&Nume_Autor') and works.
What code should I put behind a WHEN-BUTTON-PRESSED trigger to call this procedure?
Thanks for your advices and remember that I am new within the Oracle environment and also here.
Thanks again.
|
|
|
|
Re: Call a procedure [message #310403 is a reply to message #310301] |
Tue, 01 April 2008 02:05   |
bluerratiq
Messages: 22 Registered: March 2008 Location: Bucharest
|
Junior Member |
|
|
Thanks David for the answer. Silly me, sometime I "refuse" to think 
I still have a question .. how can I make use of substitution variables in Forms? I mean, that I want the user to input a value for the procedure's parameter.
In Toad I used to write:
INSERT INTO CARTI (NUME_CARTE, AN_APARITIE, STOC)
VALUES ('&NUME_CARTE',&AN_APARITIE,&STOC);
Thank you again.
[Updated on: Tue, 01 April 2008 07:58] Report message to a moderator
|
|
|
Re: Call a procedure [message #310921 is a reply to message #310403] |
Wed, 02 April 2008 19:29  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
INSERT INTO CARTI
(NUME_CARTE, AN_APARITIE, STOC)
VALUES (:blk.itm1, :blk.itm2, :blk.itm3);
David
|
|
|