--&变量名,&&变量名简析-----------------------------------------------------------
1Set VerifyOn;2Select*From tcpn_jodsmappingWhere ProductID=‘&productid‘and Producteffdate=‘&producteffdate‘3ORDERBy‘&productid ' ; 4 select * from Tcpn_ jodsmapping where ProductID = ' &&productid '
&: "& variable Name"---------eg:&name; life cycle: In a single reference, you do not need to declare, if you replace a character or date type, it is best to use a single quotation mark to extend the scope: where, order BY, column expression, table name, entire select Statement &&: "&& variable name"-------eg:&&name; life cycle: Entire session (sessions connection), no declaration required
-- ACCEPT-----------------------------------------------------------------------
1 ACCEPT pro_pid PROMPT provide the Product ID and Eff date. ' 2 select * from 3 tcpn_ jodsmapping 4 where ProductID = &pro_pid
Accept lifecycle: The entire session is pre-declared and can be customized with the hint information, using the variables declared with & references. Definition: Accept variable name name number/char/date prompt ' hint message content ' i.e.: acc[ept] variable [num[ber] | CHAR | DATE] [For[mat] format] [def[ault] default] [PROMPT text | NOPR[OMPT] [hide] Explanation: Prompt command: Used to output information that prompts the user in order to let the user know the function and operation of the script file Pause command: The run Hide option to pause the script file: Used to hide the user's input, so that others are not visible, security this The command means that when the Plsql program segment executes to the variable name, the user's interaction is required to continue, and the Plsql program segment displays "message content" for the user to enter the relevant information (if you specify the Hide option, Then in the next thing the user input will be displayed with an asterisk to increase security, a bit like entering a password, the user input content is received and paid to name, about the "content of the message" under the type of user input, PLSQL program segment developers to pass number/char/ Date specifies that, after the variable name gets the correct value, proceed to the following program!
--DEFINE-----------------------------------------------------------------------
1 DEFINE DEF010003=010003;2DEFINE DEF0100033 DEFINE DEF01000320090301=20090301;4DEFINE DEF010003200903015 SELECT * from tcpn_paymentitem6 where ProductID = '&def010003' 7 and producteffdate = '&def01000320090301'; 8 undefine DEF010003; 9 undefine DEF01000320090301;
Define: "Define variable name = variable Value" Eg:define a = Clark; life cycle: Entire session, pre-declaration, use with & reference declared variable define variable= user-created value of char type: Define variable name = value ; Define variable name: View variable command. Undefine variable Name: Clear variable define: View all substitution variables and their values in the current session
--------------------------------------------------------------------------------
Examples of Use:
1Declare2 V_salNumber6,2);3 V_ename Emp.ename%type=‘&ename‘;4Begin5Select SalInto V_salFromEmp6whereLower (ename)=Lower(V_ename);7if v_sal< 2000 then 8 update emp set sal< Span style= "color: #808080;" >=v_sal + 200 9 where lower (ename) = lower (V_ename); 10 end if; 11 end;
Alternate variable-----from cyber