我在SQL*PLUS中建立了一个变量,并以它为条件成功建立了一个视图
SQL>DEFINE A='60'
SQL>CREATE OR REPLACE VIEW V1 AS SELECT * FROM T1
WHERE F1='&A';
同时,我测试在前台调用这个视图,结果数据都有。
不知该变量A的值什么时候改变?如何改变?在前台能否改变?
You're supposed to get the data that meet the criteria, right? The variable got replaced when the CREATE VIEW statement was compiled and executed. You'll find it by SELECT TEST FROM UER_VIEWS WHERE VIEW_NAME='V1'.
To use the variable from front end, you need to include the CREATE VIEW in a procedure, which is only supported by Oracle 8 and up. For old version,DBMS_SQL package should work.