要读取用户输入并将其存储在变量中以供以后使用,可以使用sqlplus命令ACCEPT.
原文链接:https://www.f2er.com/oracle/205659.htmlAccept <your variable> <variable type if needed [number|char|date]> prompt 'message'
例
accept x number prompt 'Please enter something: '
然后您可以在PL / sql块中使用x变量,如下所示:
declare a number; begin a := &x; end; /
使用一个刺痛的例子:
accept x char prompt 'Please enter something: ' declare a varchar2(10); begin a := '&x'; -- for a substitution variable of char data type end; -- to be treated as a character string it needs / -- to be enclosed with single quotation marks