Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Create table question

Re: Create table question

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 20 Jan 2005 12:02:50 -0800
Message-ID: <41f00e6a@news.victoria.tc.ca>


peteg_at_garlic.com wrote:
: I need to create and populate a table using a select statement where
: one of the columns is initially to be populated with the value 'OK'.
: However, this creates a char type, but I need it to be a varchar2
: because, subsequently, I will be modifying the value within that
: column.

: For example, when I try to create a table like this:

: create table test as select sysdate ADate, 'OK' AFlag from dual

SQL> create table try as select decode(dummy,'Y',rpad(dummy,55),'OK') aflag from dual ;

Table created.

SQL> desc try

 Name                          Null?    Type
 ----------------------------- -------- --------------------
 AFLAG                                  VARCHAR2(55)

SQL> select * from try ;

AFLAG



OK

1 row selected.

Note the length from the rpad, and the type from dummy, and the value from the literal 'OK'.

There is probably a prettier way if you play with some other functions, but I hope you get the idea.

--

This space not for rent.
Received on Thu Jan 20 2005 - 14:02:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US