Oracle问题ACCEPT / PROMPT

时间:2014-11-25 12:04:19

标签: oracle

在oracle工作,我正在制作一个pl / sql程序。我遇到一个奇怪的问题是我的代码:

ACCEPT address char PROMPT "Please enter address : ";
ACCEPT city char PROMPT "Please enter address : ";
ACCEPT price int PROMPT "Please enter address : ";
ACCEPT agent int PROMPT "Please enter address : ";
ACCEPT seller int PROMPT "Please enter address : ";

DECLARE
address_prop properties.address %type;
city_prop properties.city %type;
price_prop properties.list_price %type;
 agent_prop properties.agent %type;
seller_prop properties.seller %type;
list_id_new int;
list_date date;

BEGIN
address_prop := '&address';
city_prop := '&city';
price := '&price';
 agent_prop := '&agent';
seller_prop := '&seller';

if agent_prop is null then
 dbms_output.put_line('error: agent is null');
 elsif seller_prop is null then
 dbms_output.put_line('error: seller is null');
elsif price_prop < 50000
then dbms_output.put_line('error: list price is less than $50000');
else
select count(list_id) + 1 into list_id_new from properties;
SELECT SYSDATE INTO list_date FROM DUAL;
INSERT INTO
properties
(list_id, address, city, list_date, list_price, agent, seller)
VALUES
(list_id_new, address_prop, city_prop, list_date, agent_prop, seller_prop);

 end if;

END;

我运行此操作并完成所有提示,然后发生错误并停止运行

ACCEPT address char PROMPT "Please enter address : ";
*
ERROR at line 1:
ORA-00900: invalid SQL statement

副本中的答案在我的案例中不起作用。这就是我尝试提出新问题的原因

0 个答案:

没有答案