Orastoredproc out params with error
Posted: Fri 03 Jul 2009 13:44
hi, i'm a newbie here,my environment are delphi 7, ODAC 6.10,oracle 10g.
i tried to make a transaction form using sequence number, then i want to catch the value from sequence number in order to increment transaction number,and insert into master and detail table.
my scenario like this:
SQL> conn scott/tiger
SQL> drop sequence order_lines_seq;
SQL> drop SEQUENCE orders_seq;
SQL> drop index INDEX orli_orde_fk_i;
SQL> CREATE TABLE orders (
2 id NUMBER(10),
3 description VARCHAR2(50),
4 CONSTRAINT orders_pk PRIMARY KEY (id)
5 );
SQL> CREATE SEQUENCE orders_seq;
SQL> CREATE TABLE order_lines (
2 id NUMBER(10),
3 order_id NUMBER(10),
4 description VARCHAR2(50),
5 CONSTRAINT order_lines_pk PRIMARY KEY (id),
6 CONSTRAINT orli_orde_fk FOREIGN KEY (order_id) REFERENCES orders(id)
7 );
SQL> CREATE INDEX orli_orde_fk_i ON order_lines(order_id);
SQL> CREATE SEQUENCE order_lines_seq START WITH 100;
CREATE OR REPLACE procedure insert_order(
l_order_id out orders.id%TYPE)is
BEGIN
INSERT INTO orders (id,description)
VALUES (orders_seq.NEXTVAL,'Dummy order description.')
RETURNING id INTO l_order_id;
INSERT INTO order_lines (id,order_id, description)
VALUES (order_lines_seq.NEXTVAL, l_order_id, 'Dummy order line description');
COMMIT;
END;
Then i used Orastoredproc with procedure name insert_order,but when executed or change active into true, the error message came out: Sql statement doesn't return row
But when i double click on orastoreproc then look at tab: params, press execute button, the value can came out with increment number.
how to catch the value that came out from sequence number in order to increment the Transaction number?
does anyone can help my problem....thanks in advance helps...
Regards, Akrein
i tried to make a transaction form using sequence number, then i want to catch the value from sequence number in order to increment transaction number,and insert into master and detail table.
my scenario like this:
SQL> conn scott/tiger
SQL> drop sequence order_lines_seq;
SQL> drop SEQUENCE orders_seq;
SQL> drop index INDEX orli_orde_fk_i;
SQL> CREATE TABLE orders (
2 id NUMBER(10),
3 description VARCHAR2(50),
4 CONSTRAINT orders_pk PRIMARY KEY (id)
5 );
SQL> CREATE SEQUENCE orders_seq;
SQL> CREATE TABLE order_lines (
2 id NUMBER(10),
3 order_id NUMBER(10),
4 description VARCHAR2(50),
5 CONSTRAINT order_lines_pk PRIMARY KEY (id),
6 CONSTRAINT orli_orde_fk FOREIGN KEY (order_id) REFERENCES orders(id)
7 );
SQL> CREATE INDEX orli_orde_fk_i ON order_lines(order_id);
SQL> CREATE SEQUENCE order_lines_seq START WITH 100;
CREATE OR REPLACE procedure insert_order(
l_order_id out orders.id%TYPE)is
BEGIN
INSERT INTO orders (id,description)
VALUES (orders_seq.NEXTVAL,'Dummy order description.')
RETURNING id INTO l_order_id;
INSERT INTO order_lines (id,order_id, description)
VALUES (order_lines_seq.NEXTVAL, l_order_id, 'Dummy order line description');
COMMIT;
END;
Then i used Orastoredproc with procedure name insert_order,but when executed or change active into true, the error message came out: Sql statement doesn't return row
But when i double click on orastoreproc then look at tab: params, press execute button, the value can came out with increment number.
how to catch the value that came out from sequence number in order to increment the Transaction number?
does anyone can help my problem....thanks in advance helps...
Regards, Akrein