我正在尝试使用具有以下行的复合变量来检索信息,但它无法正常工作。错误报告在下面,并且假设输出位于底部。我提前感谢你的任何建议。
set serveroutput on
DECLARE
TYPE type_shopper IS RECORD(
shopperid bb_shopper.idshopper%TYPE,
firstname bb_shopper.firstname%TYPE,
lastname bb_shopper.lastname%TYPE,
email bb_shopper.email%TYPE);
rec_shopper type_shopper;
lv_days_num NUMBER(1);
lv_shopper_num NUMBER(3) :=30;
BEGIN
SELECT idshopper, firstname, lastname, email
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = lv_shopper_num
lv_days_num := SYSDATE - rec_shopper.created;
lv_days_num := SYSDATE - rec_shopper.created;
DBMS_OUTPUT.PUT_LINE(rec_shopper.firstname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
/
错误报告如下。
错误报告 -
ORA-06550:第15行,第3栏:
PL / SQL:ORA-00933:SQL命令未正确结束
ORA-06550:第11行,第3栏:
PL / SQL:忽略SQL语句
06550. 00000 - “行%s,列%s:\ n%s”
*原因:通常是PL / SQL编译错误 *操作:
这是输出。
Shopper ID: 37
First Name: John
Last Name: Doe
Became shopper 1 days ago