PL / SQL execution ended with a warning?
I typed the following code on separate pages, it said the wrong procedure name. When typing in the same workspace in SQL Developer, it means execution has ended with a warning. There seems to be no conclusion.
This is a college exercise to get multiple values from multiple tables using a single user-entered value - in this case
Here we should get the title of the book, the ordered quantity and the username using the order number (
This is my code:
create or replace procedure proc2 ( ono in number , cname out varchar, book out varchar, qty out number) is temp number; begin select custid into temp from ordr where orderno = ono; select custname into cname from customer where custid = temp; select isbn,qtystock into temp,qty from order_list where orderno = ono; select title into book from books where isbn = temp; end proc2;
and my main call function:
set serveroutput on declare cname varchar(7); book varchar(7); ono number; qty number; begin ono := &ono; -- I even tried explicitly giving a value didn't work proc2(ono, cname, book, qty); dbms_output.put_line('customer name: '||cname||'book title :'||book||'quantity ordered :'||qty); end;
The procedure completed successfully, but I cannot find the error in the main function. What do you think is wrong?
Even when I have executed the following I get the function executed successfully and when I execute the main function I get the execution with a warning, I don't understand why!
create or replace function totfun(ip in number) return number is t number(5); t1 number(5); t2 number(5); begin select isbn,qtystock into t,t1 from order_list where orderno=ip; select price into t2 from books where isbn=t; return t1*t2; end totfun;
set serveroutput on; declare ip number; begin ip:=&orderno; dbms_output.put_line(totfun(ip)); end;
source to share
From the manual:
Before exiting the subroutine, assign values to all OUT forms parameters. Otherwise, the corresponding actual parameters will be zero. If you exit successfully, PL / SQL assigns values to the actual parameters. If you exit with an unhandled exception, PL / SQL will not assign values to actual parameters.
Have you assigned values to your outputs?
What are your outputs before exiting proc2?
Could it be helpful to trace your code inside the proc2 routine?
What are your warnings?
source to share