|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I'm new to Firebird. I need to build an insert statement inside procedures based on the values of the parameters it receives.I'm able to create that but unable to execute it. I'm unable to execute a simple DML statement inside the procedure.I dont know what mistake i'm making.This is the code snippet where i got error CREATE TABLE "MYTABLE" ( "ORDERID" INTEGER NOT NULL, "ISBN" CHAR(13) NOT NULL, "NO_OF_BOOKS" INTEGER NOT NULL ); CREATE PROCEDURE MYPROC(ORDERID INTEGER,ISBN CHAR(13),NO_OF_BOOKS INTEGER) AS BEGIN EXECUTE STATEMENT 'INSERT INTO MYTABLE(ORDERID,ISBN,NO_OF_BOOKS) VALUES(:ORDERID,:ISBN,:NO_OF_BOOKS)'; END And the error i received when i tried to execute the MYPROC is Error at line 1: Dynamic SQL Error SQL error code = -206 Column unknown ORDERID At line 1, column 60 Done: 1 statements, 1 errors, 0.00 s Thanks in advance -Padmavathy |
|
#2
|
|||
|
|||
|
Quote:
Try Statement = 'INSERT INTO MYTABLE( ORDERID, ISBN, NO_OF_BOOKS) VALUES(' || ORDERID ||','||ISBN || ',' ||NO_OF_BOOKS||')' ; EXECUTE STATEMENT :Statement ; |
|
#3
|
|||
|
|||
|
Quote:
Hi, Thanks for taking your time to reply. |
|
#4
|
|||
|
|||
|
sp
Hi,
To use DML Statements in a Procedures ,no need to mention 'Execute Statement'. U can directly use insert statement. CREATE PROCEDURE MYPROC(ORDERID INTEGER,ISBN CHAR(13),NO_OF_BOOKS INTEGER) AS BEGIN INSERT INTO MYTABLE(ORDERID,ISBN,NO_OF_BOOKS) VALUES(:ORDERID,:ISBN,:NO_OF_BOOKS); END The above procedure will work fine. Kishore /* Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Dynamic DML Query Formation in Stored Procedures |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|