The command 'new_value' for SQLPlus

Format:

column column_name new_value var_name

Meaning:

use the column_name of a select statment to construct a variable, later we can use &var_name to refer its value.

If the Select statement returned more that one row, the last row value will be assigned  to the variable.

 Example 1:

-- create directory and varchar2 array
col value new_value user_dump_directory;
select value from v$parameter where name = ‘user_dump_dest‘;
create or replace directory user_dump_dir as ‘&user_dump_directory‘;

Example 2
set feedback off
set verify off

create table new_value_test_from (
  some_field_name Varchar2(20)
);

create table new_value_test_to (
  another_field Varchar2(20)
);
insert into new_value_test_from values (‘Maegerli Mucki‘); column some_field_name new_value some_var_name select some_field_name from new_value_test_from; insert into new_value_test_to values (‘&some_var_name‘); select * from new_value_test_to; drop table new_value_test_from; drop table new_value_test_to;
set feedback off
set verify off

create table new_value_test (
  some_field_name Varchar2(20)
);

Example 3
insert into new_value_test values (‘Maegerli Mucki‘); insert into new_value_test values (‘Globi‘); column some_field_name new_value some_var_name select some_field_name from new_value_test; drop table new_value_test;

The command 'new_value' for SQLPlus,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。