码迷,mamicode.com
首页 > 数据库 > 详细

The command 'new_value' for SQLPlus

时间:2014-07-24 22:38:53      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   color   strong   for   re   c   

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,布布扣,bubuko.com

The command 'new_value' for SQLPlus

标签:des   style   http   color   strong   for   re   c   

原文地址:http://www.cnblogs.com/princessd8251/p/3866380.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!