3
我在單獨的頁面中輸入了下面的代碼,它表示無效的過程名稱。當在SQL Developer中的同一個工作空間中鍵入時,它表示執行完成並出現警告。似乎根本沒有產出。PL/SQL執行完成並出現警告?
這是一所大學的運動,從使用用戶輸入一個值幾個表得到幾個值 - 在這種情況下ono
。
在這裏,我們應該得到的書,訂購數量以及使用客戶名稱訂單號(ono
)的稱號。
這是我的代碼:
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;
和我的主要調用函數:
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;
的過程已成功執行,但我似乎無法找到在主函數中的錯誤。你認爲什麼是錯的?
即使當我執行我得到函數執行成功,當我執行的主要功能我得到警告執行,我不明白爲什麼以下!
功能:
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;
使用'show errors'查看'CREATE ...'後面的編譯錯誤。您還應該閱讀多個'SELECT'語句。據我所知,只需一條語句「加入」表即可獲得相同的信息。 – 2012-03-25 13:25:48
這是一個不錯的主意,我會嘗試;) – LoveMeow 2012-03-25 15:39:06