Home » SQL & PL/SQL » SQL & PL/SQL » view to see create table script (oracle 10g)
view to see create table script [message #396645] Tue, 07 April 2009 07:21 Go to next message
gauravpuri2002
Messages: 24
Registered: October 2007
Location: Bangalore
Junior Member
Hi I have created table t1 as

create table t1
as
select * from t2;

I forgot this script so Is there is any view where I can see this script for table t1.
Re: view to see create table script [message #396646 is a reply to message #396645] Tue, 07 April 2009 07:25 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
USE
DBMS_METADATA.GET_DDL

Ex
IND> select dbms_metadata.get_ddl('TABLE','EMP') from dual;

  CREATE TABLE "APPOWNER"."EMP"
   (    "EMPNO" NUMBER(4,0) NOT NULL ENABLE,
        "ENAME" VARCHAR2(10),
        "JOB" VARCHAR2(9),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "DATA"



1 row selected.
Re: view to see create table script [message #396649 is a reply to message #396645] Tue, 07 April 2009 07:30 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
gauravpuri2002 wrote on Tue, 07 April 2009 14:21
Hi I have created table t1 as

create table t1
as
select * from t2;

I forgot this script so Is there is any view where I can see this script for table t1.

You cannot retrieve the actual statement you used to create this table. I figure you used some complex where-clause or colums-list or whatever. No way to get that where-clause back.
Previous Topic: How to cut a string in one string. [merged]
Next Topic: Query recent records
Goto Forum:
  


Current Time: Tue Dec 06 08:53:18 CST 2016

Total time taken to generate the page: 0.08335 seconds