How to see DDL script(create table) from view
i want to view create table script(DDL command)
can u suggest me any view for that.
Hi
There's no view where the DDL statement is directly available. It must be reconstructed from many views...
If you use 9i the simpler way to do that is with DBMS_METADATA. Below and example....
SQL> SET LONG 1000000
SQL> SELECT dbms_metadata.get_ddl('TABLE','EMP') FROM dual;
DBMS_METADATA.GET_DDL('TABLE','EMP')
CREATE TABLE "SCOTT"."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),
CONSTRAINT "EMP_PK" PRIMARY KEY ("EMPNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "EMP_DEPT_FK" FOREIGN KEY ("DEPTNO")
REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
) 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 "USERS"
Chris
Similar Messages
-
Create table from view giving error
i am trying to creating a table from view it is giving following error. can you please help
create table jd as
select * from A.ab_v where 1=2;
error
ORA-01723
zero columns not allowedAs others already pointed out you have NULL as view column(s). You need to either modify view and use CAST(NULL AS desired-type). For example:
SQL> create or replace
2 view v1
3 as
4 select null new_date
5 from dual
6 /
View created.
SQL> create table tbl
2 as
3 select *
4 from v1
5 /
select *
ERROR at line 3:
ORA-01723: zero-length columns are not allowed
SQL> create or replace
2 view v1
3 as
4 select cast(null as date) new_date
5 from dual
6 /
View created.
SQL> create table tbl
2 as
3 select *
4 from v1
5 /
Table created.
SQL> drop table tbl
2 /
Table dropped.
SQL> create or replace
2 view v1
3 as
4 select cast(null as number) new_number
5 from dual
6 /
View created.
SQL> create table tbl
2 as
3 select *
4 from v1
5 /
Table created.
SQL> Or list individual view columns with NULL CASTing in CTAS:
SQL> create or replace
2 view v1
3 as
4 select null new_date
5 from dual
6 /
View created.
SQL> create table tbl
2 as
3 select cast(new_date as date) new_date
4 from v1
5 /
Table created.
SQL> desc tbl
Name Null? Type
NEW_DATE DATE
SQL> set null NULL
SQL> select *
2 from tbl
3 /
NEW_DATE
NULL
SQL> SY. -
ADF BC creating table from view
This is plain stupid all this crap of IDE's and Frameworks and things alike. I just loose a few days of work trying to do the simplest thing, create a table from a BC view. I did what the tutorials say, just drag&drop a %$$/& data control from the data control pallete and so on...
The IDE just add a lot of libraries to my project, changed a bunch of things in web.xml and God knows where more, and the result is this:
java.lang.ClassCastException: oracle.adfinternal.view.faces.uinode.UIComponentUINode at oracle.adfinternal.view.faces.uinode.UIXComponentUINode.__getAdapter(UIXComponentUINode.java:435) at oracle.adfinternal.view.faces.uinode.UINodeRendererBase.encodeBegin(UINodeRendererBase.java:29) at oracle.adf.view.faces.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:528) at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:584) at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:471) at oracle.adf.view.faces.webapp.UIXComponentTag.doStartTag(UIXComponentTag.java:82) at loginPage.jspService(_loginPage.java:70) [loginPage.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:298) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:42) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:205) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209) at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147) at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:134) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:264) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:151) at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:123) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) at oracle.adfinternal.view.faces.webapp.FacesFilter.doFilter(FacesFilter.java:89) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:595)
What's the use of these tools? If i were to made this on my one i had my work done by know instead of loosing some days of work...
Anybody could help hereSo basically that means that instead of being me, the programmer, that tells the machine what to do, it's the machine, by means of a framework, that tells me what to do... So much for the fun and criativity of being a programmer, now we're supposed to be some simple technocrats that assemble code in a production-line instead of artists that create some nice piece of work that not only works but it's beautifull too. I think i'm getting too old for this, maybe it's time to move up onto management...
I don't resist to tell this little story:
Once upon a time, in mid-ages Rome, a wise bishop was walking down the lane when he sees two workers laying down bricks. He ask one of then;
- Good men , what are you doing?
- Laying down bricks, the man answers...
And then asks the second man,
- And you, my good man, what are you doing?
- I'm building a Cathedral...
I allways think of myself as "building Cathedrals", now after all these years i have to just "lay out bricks"? -
Error while creating table from csv file
I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
Any idea?I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
Any idea? -
How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working. I want to delete all tables using Query Analyzer, i.e. through SQL Query.
Please help me out in this concern.
Nishith ShahInformative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
declare @TTName Table
(TableSchemaTableName
varchar
(500),
[status] int
default 0);
with AvailableTables
(TableSchemaTableName)
as
(select
QUOTENAME(TABLE_SCHEMA)
+
+
QUOTENAME(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES)
insert into @TTName
(TableSchemaTableName)
select *
from AvailableTables
declare @TableSchemaTableName varchar
(500)
declare @sqlstatement nvarchar
(1000)
while 1=1
begin
set @sqlstatement
=
'DROP TABLE '
+ @TableSchemaTableName
exec
sp_executeSQL
@sqlstatement
print
'Dropped Table : '
+ @TableSchemaTableName
update @TTName
set [status]
= 1
where TableSchemaTableName
= @TableSchemaTableName
if
(select
count([Status])
from @TTName
where [Status]
= 0)
= 0
break
end -
Inserting the column values into table from view through procedure!!!
below is my example code
Create or replace procedure test_proc
is
cursor test_cur is
select a.col1 , b.col2, c.col3, d.col4, e.col5
from tableA a, tableB b, tableC c, tableD d, tableE e;
test_cur_rec test_cur%rowtype;
Begin
insert into test_stg ( col1, col2, col3, col4, col5, col6, col7)
Values ( test_cur_rec. col1,
test_cur_rec .col2,
test_cur_rec .col3,
test_cur_rec .col4,
test_cur_rec .col5
-- col6, col7 );
create view test2 (
select f.col6, g.col7 from tableF f,tableG g);
I m trying to insert values into the table test_stg but for col6 and col7 i need to get the data from the view test2.
In simple word, all i need to do is get the 2 columns data from view and insert into a table through procedure. The above code is the example which looks very much like my actual code.
How do i accomplish this task ??well there is joining condition for a, b,c ,d, e tables, i have not mentioned here. The where condition has nothing to do with the other two columns of the view.
There is no relation ship between the these tables the view. The col 6 and 7 i m inserting from view is sysdate timestamp and the job_id number.
so its pretty straight forward insertion into the table from view columns. These two columns has just one row with id number and timestamp. so i need to insert these data into the the table when i run a procedure.
Thank you so much!!! -
How to call a custom controller method from view
Hi,
I ve created a simple web service and consumed it in a model. Mapped the input & output parameters to custom controller context which in turn mapped to component controller's context which in turn to view's contexts.
How to call a custom controller method from view?
Please explain the syntax.
Regards,
Manoj.Hi Patralekha,
Give some idea for the below scenario:
I ve created a simple web service and consumed it in a model. What I did was
1) for the input parameters, mapped the node from view->custom controller->model
2)for the output parameter, mapping from model->custom controller->view.
It works fine.
But I don't want to access model nodes directly, rather I want to set the input param in somewhere else (like custom controller) before calling the appropriate method, same for the response also.
Share me your thoughts.
Regards,
Manoj. -
How to do hibernate mapping for table or view without a primary key
Hi,
Anyone knows how to do hibernate mapping for table or view without a primary key?
thanks.
ccor you can make all column primary key .Anybody seriously considering that as a good idea should understand the implications:
1. this requires that each row be unique - that's a minor issue normally, but can be a significant problem in some cases
2. in practically all databases, a primary key constraint creates a unique index - this has many implications:
a) in most databases, the index stores a copy of the column data that is indexed - this suggestion therefore more than doubles the data storage required for the data
b) whenever an indexed column is changed, the index has to be maintained - this suggestion then more than doubles the work that each UPDATE statement has to do, since both the table and the index have to be maintained for any UPDATE at all
This might work OK for toy projects, but it doesn't scale well at all... -
How can i stop the download box from viewing evertime i download something?
how can i stop the download box from viewing everytime i download something?
Open Firefox, choose Tools on the menu bar, then Options, General, and there's a tickbox option to deactivate the Downlaods window.
-
How to create table from method
Hello -
Could anyone please tell me how can I create af:table with more than one column from an AppsModule method.
When I have a 1d array return eg:
public String[] createTable(){
String[] str = new String[1];
return str;
I can drop it as a table and one column gets created. But how can I get mutiple columns in a table. I want to write a method, which when dropped on jsp page create table with multiple columns.
I am using ADF 11g.
Please suggest.
Regards -
RohitHi,
for this you use an array or array list of objects. The object represent the row content, e.g. Person. The Person class then has setter/getter for each of the properties that you want to show in a column
Frank -
How to create table from another in pl/sql
Hi I need to create a table from another in pl/sql
How can I do thisThe proper way to do this, is not to do it in PL/SQL. But do it in SQL, something like:
create table tbl
as
select *
from other_tbl;Doing it in PL/SQL is really slow compared to SQL.
Yes, if you really want to create a table using PL/SQL then you will need to use DBMS_SQL or EXECUTE IMMEDIATE (Native Dynamic SQL) to do this. -
Script to create tables from an existing database
I need a script to create tables without storage parameters from existing database
Please repost your question in the database forum, General Database Discussions
-
How to create table from one to another schema?
Hi,
There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
thanks in advance
Thanks,user2017273 wrote:
Hi,
There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
thanks in advance
Thanks,When you give CREATE ANY TABLE TO A then user A will create table on any schema.But you can create stored PROCEDURE on schema B for creating table and give GRANT EXECUTE <PROC NAME> to A. -
Allowing user to see a newly created table
Hi ,
I have created a new table tbl1 in tblspace1 and grant select , delete , insert to user1
how can i allow the user1 to see the new table tbl1 ?
kindly advise
tks & rdgsSQL>
SQL> SHOW USER
USER is "ADMIN"
SQL>
SQL> CREATE TABLE TEST AS SELECT * FROM TAB;
Table created.
SQL> GRANT SELECT,INSERT,UPDATE ON TEST TO MYTEST;
Grant succeeded.
SQL> CONN MYTEST
Enter password: *******
Connected.
SQL> DESC ADMIN.TEST
Name Null? Type
TNAME NOT NULL VARCHAR2(30)
TABTYPE VARCHAR2(7)
CLUSTERID NUMBER
Cheers -
Getting error while creating table from one database to other.
Hi,
We are getting below error while creating the table from one database to other.
SQL> create table fnd_lobs parallel compress as select * from [email protected];
create table fnd_lobs parallel compress as select * from [email protected]
ERROR at line 1:
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
Regards,
Bhatiahi
what are the apps version local and remote database???
Snapshot too old errors occur because Oracle can 't reconstruct a consistent
image of a block for the purposes of a consistent read.
I feel at remote database, you are using UNDO, it will be rather easy to iincrease the undo retention time or increase the undo tablespace size.. if you are dealing with roll back segments, you may have rollback segments whose optimal values are too small...
increase roll back segments size and select again then
the following metalink notes might be helpful
ORA-01555 "Snapshot too old" - Detailed Explanation Doc ID: 40689.1
How To Avoid ORA-01555: Snapshot Too Old When Running PAAPIMP Doc ID: 603259.1
OERR: ORA 1555 "snapshot too old (rollback segment too small)" Doc ID: 18954.1
Maybe you are looking for
-
Iphone ical events wont show up in ical
I have had an iphone for a few months now and recently got a imac G5 with OS X 10.4.11. I am trying to sync my iphone calendar with my imac ical software, but none of my events will show up on the imac. All of my contacts have synced, but not the cal
-
New hard drive and photoshop license problem
I have a Dell Inspiron 6000 with a 1.5 Ghz Pentium processor, 2 GB of RAM, and Win Xp/Pro SP3. The hard drive in this computer failed, and it has been replaced. I used an image backup from Acronis True Image 10 to "restore" the new disk. Now, when I
-
Has anyone found a way to add items like books, music, and apps to a wish list via the iPad. I've seen some info for how to do this in iTunes, but that doesn't help me on my iPad.
-
Hi Every Body, Please I would like to know how could I add the cost distribution "info Type 0027" to the fast entry menu "Pa70" Kind Regards, Darweesh
-
How is the Logic Express Notation?
I am going to begin creating and selling sheet music. Does anyone have experience with the Logic Express Notation? Is it professional quality (where I can add things like first and second endings and codas, etc.)?