sasfvs

Untitled

Jul 5th, 2017
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.64 KB | None | 0 0
  1. VARIABLE v_bind1 VARCHAR2(10); -- no block section no nothing, just a bind variable declaration
  2. EXEC :v_bind1 := 'hacker'; -- this is how you initialize the variable using the command EXEC (Execute)
  3. SET SERVEROUTPUT ON;
  4. BEGIN
  5.     :v_bind1 := 'cracker'; -- second way of initialize
  6. END;
  7. /
  8. -- note the ":"
  9. -- Now let's display the bind variable value. In 3 different ways:
  10.  
  11. -- 1. DBMS_OUTPUT package
  12. BEGIN
  13.     :v_bind1 := 'cracker';
  14.     DBMS_OUTPUT.PUT_LINE(:v_bind1);
  15. END;
  16.  
  17. -- 2. Print command
  18. PRINT :v_bind1; -- as a single command and also no blocks are needed
  19.  
  20. -- 3. Using AUTOPROINT
  21. SET AUTOPRINT ON; - will print automatic AT initialization
Advertisement