- Oracle variables are not prefixed with @ like in SQL Server.
- Oracle queries must have a
FROM
clause; there is a system-provided dummy table called DUAL for this - In Oracle, the line between SQL code and procedural code is far harder than in SQL Server.
If all you want to do is print out the value of a variable, you will need to do something like this:
DECLARE
var_name NVARCHAR2(5) := 'Vinay';
BEGIN
-- Enable printing
DBMS_OUTPUT.ENABLE();
-- Print the value
DBMS_OUTPUT.PUT_LINE(var_name);
END;
/
Note: If you are doing this in SQL*Plus, you must issue SET SERVEROUTPUT ON
to see the result.