COL[UMN] [{column | expr} NEW_V[ALUE] variableSpecifies a variable to hold a column value. You can reference the variable in TTITLE commands. Use NEW_VALUE to display column values or the date in the top title. You must include the column in a BREAK command with the SKIP PAGE action. The variable name cannot contain a pound sign (#).实例现有一表t1 SQL> select * from t1; NAME ---------- 中国 中国2 SQL>col name new_v v; --- 把title是name的值存到v这个变量里 SQL> set verify off; --- 不显示替代变量被替代前后的语句 SQL> select * from t1 order by name; NAME ---------- 中国 中国2运行到这里实际就是把 中国2 存到v变量里了实验如下: SQL> execute dbms_output.put_line('&v'); 中国2 PL/SQL 过程已成功完成。SQL> select * from t1 where name='&v'; NAME ---------- 中国2
SQL> select * from t1;
NAME
----------
中国
中国2
SQL>col name new_v v; --- 把title是name的值存到v这个变量里
SQL> set verify off; --- 不显示替代变量被替代前后的语句
SQL> select * from t1 order by name;
NAME
----------
中国
中国2运行到这里实际就是把 中国2 存到v变量里了实验如下:
SQL> execute dbms_output.put_line('&v');
中国2
PL/SQL 过程已成功完成。SQL> select * from t1 where name='&v';
NAME
----------
中国2