14 Mart 2022 Pazartesi

SET - System Variables

verify off
Açıklaması şöyle
The VERIFY setting controls whether or not SQL*Plus displays before and after images of each line that contains a substitution variable.
Örnek
Şöyle yaparız
SQL> DEFINE dummy_char = 'X'
SQL> SELECT * FROM dual 2 WHERE dummy = '&&dummy_char'; old 2: where dummy = '&&dummy_char' new 2: where dummy = 'X' D - X
Açıklaması şöyle
Notice that line 2, which contained the reference to the &&dummy_char substitution variable, was displayed before and after the reference to the variable was replaced by its value. If you don’t like this display, you can turn it off with SET VERIFY OFF.
Örnek
Şöyle yaparız
DEFINE OBJ_NAME="foo"
DECLARE
  N INTEGER := 0;
BEGIN
  SELECT COUNT(OBJECT_NAME) INTO N FROM USER_OBJECTS WHERE OBJECT_NAME='&OBJ_NAME' AND
    OBJECT_TYPE='FUNCTION';
  IF N != 0 THEN
    RAISE_APPLICATION_ERROR( -20001, '&OBJ_NAME ALREADY EXISTS!' );
  END IF;
END;
/
Çıktı olarak şunu alırız
SQL> @foo.SQL
old   4:  SELECT COUNT(OBJECT_NAME) INTO N FROM USER_OBJECTS WHERE OBJECT_NAME='&OBJ_NAME'
  AND OBJECT_TYPE='FUNCTION';
new   4:  SELECT COUNT(OBJECT_NAME) INTO N FROM USER_OBJECTS WHERE OBJECT_NAME='FOO_LIST'
  AND OBJECT_TYPE='FUNCTION';
old   6:  RAISE_APPLICATION_ERROR( -20001, '&OBJ_NAME ALREADY EXISTS!' );
new   6:  RAISE_APPLICATION_ERROR( -20001, 'GET_FALIST ALREADY EXISTS!' );
Örnek
Şöyle yaparız
SQL> set verify off
SQL> DECLARE
  2          inputData VARCHAR2(1024);
  3  BEGIN
  4          inputData :='&&inputData' ;
  5          Dbms_Output.put_line('Value entered is:' || inputData);
  6  END;
  7  /
Enter value for inputdata: sdf

PL/SQL procedure successfully completed.

SQL>
Çıktı olarak şunu alırız
Enter value for inputdata: check
old   4:         inputData :='&&inputData' ;
new   4:         inputData :='check' ;
Value entered is:check

PL/SQL procedure successfully completed.



Hiç yorum yok:

Yorum Gönder