D: \ test. SQL script:
- Select& 1From& 2;
- Exit;
Run the following command to pass the parameter: sqlplus "scott/tiger @ test" @ d: \ test. SQL sysdate dual
Note: The parameter must be represented by & [1-9]. Otherwise, you will be prompted to manually enter the parameter.
- C: \> sqlplus"Scott/tiger @ test"@ D: \ test. SQL sysdate dual
- D: \> sqlplus"Scott/tiger @ test"@ D: \ test. SQL sysdate dual
- SQL * Plus: Release 11.2.0.1.0 ProductionOnTuesday November 1 21:59:00 2011
- Copyright (c) 1982,201 0, Oracle.AllRights reserved.
- Connect:
- OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-Production
- WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
- Original Value 1:Select& 1From& 2
- New value 1:SelectSysdateFromDual
- SYSDATE
- --------------
- September 11-11
- From OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-Production
- WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options disconnected
- Open
- D: \>
If the same value is used repeatedly in the script, IF & 1 = & 2:
D: \ tes2. SQL
- DeleteScott. empWhere No= & 1OrDeptno = & 2;
- Commit;
During execution, two parameters must be passed:
- Sqlplus"Scott/tiger @ test"@ D: \ test2. SQL 10 10
TIPS: If procedure is used, you do not need to pass multiple identical parameters, but only one parameter is required:
D: \ test3. SQL
- Declare
- Var_no number: = & 1;
- Begin
- DeleteScott. empWhere No= Var_noOrDeptno = var_no;
- Commit;
- End;
Sqlplus "scott/tiger @ test" @ d: \ test3. SQL 10