A reader, March 18, 2021 - 8:51 pm UTC
Sir, I executed exactly these commands as you did. I executed them in Version: 18.104.22.168.0
Could this version be problem? which was not letting to execute these commands.
This problem occurs at my side
A reader, March 18, 2021 - 8:53 pm UTC
SQL> VARIABLE tmp_var VARCHAR2(10)=Smith
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | BLOB | BFILE
REFCURSOR | BINARY_FLOAT | BINARY_DOUBLE ] ]
support for input binding on "variable" command
Rajeshwaran Jeyabal, March 20, 2021 - 3:32 pm UTC
Support for input binding by using the VARIABLE command. The VARIABLE command now supports input binding which can be used in SQL and PL/SQL statements.
As mentioned on the docs, it is a new feature of SQL*Plus version 12.2 and above.
so you should be using the sql*plus version 12.2 and above to get it worked.
demo@XEPDB1> variable x number = 55
demo@XEPDB1> exec dbms_output.put_line('x = '||:x);
x = 55
PL/SQL procedure successfully completed.
demo@XEPDB1> print x
demo@XEPDB1> $ sqlplus -version
SQL*Plus: Release 22.214.171.124.0 - Production
March 22, 2021 - 7:30 am UTC
sounds like its time to upgrade :-)