Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VARIABLE v_bind1 VARCHAR2(10); -- no block section no nothing, just a bind variable declaration
- EXEC :v_bind1 := 'hacker'; -- this is how you initialize the variable using the command EXEC (Execute)
- SET SERVEROUTPUT ON;
- BEGIN
- :v_bind1 := 'cracker'; -- second way of initialize
- END;
- /
- -- note the ":"
- -- Now let's display the bind variable value. In 3 different ways:
- -- 1. DBMS_OUTPUT package
- BEGIN
- :v_bind1 := 'cracker';
- DBMS_OUTPUT.PUT_LINE(:v_bind1);
- END;
- -- 2. Print command
- PRINT :v_bind1; -- as a single command and also no blocks are needed
- -- 3. Using AUTOPROINT
- SET AUTOPRINT ON; - will print automatic AT initialization
Advertisement