Create Create table statement dynamicallly
I am trying to create a SP that return a “Create table “statement dynamically using a table called “Employee” in database. How can I create a dynamic Create Table
statement using sys.table? The create table statement should contains all the columns from Employee table.. i am using SQL server 2008 R2
Hi SSAS_5000,
If you don't care about the constraints,dependency on the Table Employee and what you'd like is the table structure, you may use the below statement where the create statement generated from the SP is executed.
SELECT TOP 1 * INTO desiredTable FROM Eemploy;
TRUNCATE TABLE desiredTable
If you have question, feel free to let me know.
Eric Zhang
TechNet Community Support
Similar Messages
-
Using case when statement in the select query to create physical table
Hello,
I have a requirement where in I have to execute a case when statement with a session variable while creating a physical table using a select query. let me explain with an example.
I have a physical table based on a select table with one column.
SELECT 'VALUEOF(NQ_SESSION.NAME_PARAMETER)' AS NAME_PARAMETER FROM DUAL. Let me call this table as the NAME_PARAMETER table.
I also have a customer table.
In my dashboard that has two pages, Page 1 contains a table with the customer table with column navigation to my second dashboard page.
In my second dashboard page I created a dashboard report based on NAME_PARAMETER table and a prompt based on customer table that sets the NAME_ PARAMETER request variable.
EXECUTION
When i click on a particular customer, the prompt sets the variable NAME_PARAMETER and the NAME_PARAMETER table shows the appropriate customer.
everything works as expected. YE!!
Now i created another table called NAME_PARAMETER1 with a little modification to the earlier table. the query is as follows.
SELECT CASE WHEN 'VALUEOF(NQ_SESSION.NAME_PARAMETER)'='Customer 1' THEN 'TEST_MART1' ELSE TEST_MART2' END AS NAME_PARAMETER
FROM DUAL
Now I pull in this table into the second dashboard page along with the NAME_PARAMETER table report.
surprisingly, NAME_PARAMETER table report executes as is, but the other report based on the NAME_PARAMETER1 table fails with the following error.
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1756 message: [Oracle][ODBC][Ora]ORA-01756: quoted string not properly terminated. [nQSError: 16014] SQL statement preparation failed. (HY000)
SQL Issued: SET VARIABLE NAME_PARAMETER='Novartis';SELECT NAME_PARAMETER.NAME_PARAMETER saw_0 FROM POC_ONE_DOT_TWO ORDER BY saw_0
If anyone has any explanation to this error and how we can achieve the same, please help.
Thanks.Hello,
Updates :) sorry.. the error was a stupid one.. I resolved and I got stuck at my next step.
I am creating a physical table using a select query. But I am trying to obtain the name of the table dynamically.
Here is what I am trying to do. the select query of the physical table is as follows.
SELECT CUSTOMER_ID AS CUSTOMER_ID, CUSTOMER_NAME AS CUSTOMER_NAME FROM 'VALUEOF(NQ_SESSION.SCHEMA_NAME)'.CUSTOMER.
The idea behind this is to obtain the data from the same table from different schemas dynamically based on what a session variable. Please let me know if there is a way to achieve this, if not please let me know if this can be achieved in any other method in OBIEE.
Thanks. -
How to specify tablespace for a primary key inde in create table statement
How to specify the tablespace for a primary key index in a create table statement?
Does the following statement is right?
CREATE TABLE 'GPS'||TO_CHAR(SYSDATE+1,'YYYYMMDD')
("ID" NUMBER(10,0) NOT NULL ENABLE,
"IP_ADDRESS" VARCHAR2(32 BYTE),
"EQUIPMENT_ID" VARCHAR2(32 BYTE),
"PACKET_DT" DATE,
"PACKET" VARCHAR2(255 BYTE),
"PACKET_FORMAT" VARCHAR2(32 BYTE),
"SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") TABLESPACE "INDEX_DATA"
TABLESPACE "SBM_DATA"; Thank you
Edited by: qkc on 09-Nov-2009 13:42As orafad indicated, you'll have to use the USING INDEX clause from the documentation, i.e.
SQL> ed
Wrote file afiedt.buf
1 CREATE TABLE GPS
2 ("ID" NUMBER(10,0) NOT NULL ENABLE,
3 "IP_ADDRESS" VARCHAR2(32 BYTE),
4 "EQUIPMENT_ID" VARCHAR2(32 BYTE),
5 "PACKET_DT" DATE,
6 "PACKET" VARCHAR2(255 BYTE),
7 "PACKET_FORMAT" VARCHAR2(32 BYTE),
8 "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
9 CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") USING INDEX TABLESP
ACE "USERS"
10 )
11* TABLESPACE "USERS"
SQL> /
Table created.Justin -
Create Dynamic table name in the select statement.
I use oracle reports 6i to make myrep.rdf , this report created using certain select query Q1, I created a formula column in this report,
in the formula column I write pl/sql block statements to select the data from certain table depends on the output of a column in Q1,
I want to make the pl/sql block dynamically enough to change the user which I select the data from depends on the connected user
Ex: if I connected with user = 'KAM14'
the pl/sql block will be
select x into v_value from kam13.bil_file where .....;
and if I connected with user = 'KAM13'
the pl/sql block will be
select x into v_value from kam12.bil_file where .....;
and so on
how can I do this in the pl/sql block ...
Thanks in Advance.I am not sure I understood properly, but I think you should create bil_file table under a different user and create synonyms under KAM1x users.
Regards -
Create table statement in Dynamic SQL
Hello,
I am trying to create a table as a select query through a PL/SQL block using dynamic SQL. Following is the query,
declare
stmt varchar2(2000);
begin
stmt := '''CREATE TABLE output AS SELECT PATIENT_ID, FIRST_NAME FROM employee''';
execute immediate stmt;
end;
it throws the following error.
declare
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 5
I have tried to execute the statement without the variable and it executes fine. I mean,
begin
execute immediate ' CREATE TABLE output AS SELECT PATIENT_ID, FIRST_NAME FROM employee ';
end;
works flawlessly. Can you please help me with this.
ThanksHi,
declare
stmt varchar2(2000);
begin
stmt := 'CREATE TABLE output AS SELECT PATIENT_ID, FIRST_NAME FROM employee';
execute immediate stmt;
end;Nothing different from what Anurag has shown above.
But you will have to consider a few things.
1) Since it is possible it is not a must to use it
2) It is considered a bad design where in you have to create tables on the fly.
3) Consider if it is absolutely required.If u can give us an idea of your requirement.I am sure the Gurus here can give you suggestions
4) this kind of design will lead you into trouble sooner or later for sure
Regards,
Bhushan -
Caculated column in a Create Table statement
This is my create table statement:
CREATE TABLE DTPartInv
( partinv_partnbr VARCHAR2(10) NOT NULL,
partinv_prodname VARCHAR2(25),
partinv_desc VARCHAR2(25),
partinv_manufact VARCHAR2(25),
partinv_instock INTEGER NOT NULL,
partinv_category VARCHAR2(20),
partinv_purchdate DATE,
partinv_loc VARCHAR2(15),
partinv_price NUMBER(6,2),
partinv_vendor VARCHAR2(20),
partinv_reorder INTEGER NOT NULL,
partinv_serial VARCHAR2(20),
partinv_flag as (case when partinv_instock < partinv_reorder then 'X' else 'O' end), calculated column
CONSTRAINT DTPartInv_partinv_partnbr_pk
PRIMARY KEY (partinv_partnbr)
and these are my Insert into table statements:
INSERT INTO DTPartInv VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-APR-10','DD-MON-RR'),Null,45.95,'Oracle Auto Parts',1,Null);
INSERT INTO DTPartInv VALUES('CH9260',Null,'Oil Filter','Mechanical Parts',5,'Fuild Filters',TO_DATE('15-Jan-10','DD-MON-RR'),Null,20.00,'Sink Auto P',2,Null);
INSERT INTO DTPartInv VALUES('15W40',Null,'Oil','Sink Oil',20,'Auto Fuilds',TO_DATE('10-Feb-11','DD-MON-RR'),Null,10.00,'Oracle Auto Parts',5,Null,);
INSERT INTO DTPartInv VALUES('C9262',Null,'Fuel Filter','Mechanical Parts',2,'Fuild Filters',TO_DATE('20-Oct-10','DD-MON-RR'),Null,35.95,'Sink Auto Parts',1,Null);
INSERT INTO DTPartInv VALUES('PS7716',Null,'Fuel/Water Separator','Mechanical Parts',4,'Fuild Filters',TO_DATE('09-Dec-10','DD-MON-RR'),Null,50.00,'Sink Auto Parts',1,Null);
INSERT INTO DTPartInv VALUES('800142',Null,'PPI Valve','Beink Pipes Inc',10,'Valves',TO_DATE('01-Jun-11','DD-MON-RR'),Null,20.00,'Oracle Auto Parts',2,Null);
INSERT INTO DTPartInv VALUES('TTS400',Null,'Butt Clamp','Beink Pipes Inc',10,'Valves',TO_DATE('31-Oct-11','DD-MON-RR'),Null,15.95,'Oracle Auto Parts',2,Null);
INSERT INTO DTPartInv VALUES('TBA400',Null,'Lap Clamp','Beink Pipes Inc',10,'Valves',TO_DATE('10-Nov-11','DD-MON-RR'),Null,30.00,'Oracle Auto Parts',2,Null);
INSERT INTO DTPartInv VALUES('SC16650',Null,'Brake pads','CostVB Mechanical',5,'Mechanical Parts',TO_DATE('15-May-11','DD-MON-RR'),Null,60.00,'Adosql Auto Parts',1,Null);
INSERT INTO DTPartInv VALUES('OB46613',Null,'Emergency Door Latch','CostVB Mechanical',3,'Mechanical Parts',TO_DATE('01-Sep-11','DD-MON-RR'),Null,45.95,'Adosql Auto Parts',1,Null);
And this is a sample of the error I'm geeting:
INSERT INTO DTPartInv VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-APR-10','DD-MON-RR'),Null,45.95,'Oracle Auto Parts',1,Null)
ERROR at line 1:
ORA-00947: not enough values
I need to figure out, what it is that I am missing here. partinv_flag is supposed to be calculated based on partinv_instock and partinv_reorder.You need to name columns:
1 INSERT INTO DTPartInv
2 (partinv_partnbr, partinv_prodname, partinv_desc, partinv_manufact, partinv_instock, partinv_category, partinv_purchdate,
3 partinv_loc, partinv_price, partinv_vendor, partinv_reorder, partinv_serial)
4* VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-01-10','DD-MM-RR'),Null,45.95,'Oracle Auto Parts',1,Null)
SQL> /
1 row created.
SQL> select * from dtpartinv;
PARTINV_PA PARTINV_PRODNAME PARTINV_DESC
PARTINV_MANUFACT PARTINV_INSTOCK PARTINV_CATEGORY PARTINV_
PARTINV_LOC PARTINV_PRICE PARTINV_VENDOR PARTINV_REORDER
PARTINV_SERIAL P
XT40010E Exhaust Pipe
TMC Inc 2 Pipes 11/01/10
45,95 Oracle Auto Parts 1
OEdited by: P. Forstmann on 21 nov. 2011 18:57
Edited by: P. Forstmann on 21 nov. 2011 19:00 -
Create table statement from DatabaseMetaData
Hi Experts,
Do you know if it's possible to retrieve a create table statement based on a DatabaseMetaData ? (without looping through columnName / Type)
The idea is to get the DatabaseMetaData from one db server, and execute the Create Table statements on a different db server.
One obvious solution would be to loop through each table's column name/type and construct the create table statement manually, but I'd like to know whether this can be automated.
Thanks in advnace,
SidBigger databases provide a way to access most schema information from the database itself. That doesn't mean that the jdbc meta information is sufficient nor the best way to do that.
There are existing tools that allow for migrations as well. Especially if the migration is a one to one mapping. -
i am accessing the local database through JDBC for an application. but i've been getting "not allowed" errors while trying to execute a CREATE TABLE statement in my servlet. It allows all other statements like insert, delete, select etc. i've been using a default table because of the same reason.
so if someone could please throw some light into it.Hi,
Statements like Create which is a Data definition one
will not be entertained by the program while executing.
The reason being the DB cannot allocate the required buffer for crating a table at the time of execution.
So the alterantive is create your DB table manually in ur Db and try other DML statements.
Hope it helps.
Regards,
Guru -
SQL Developer Create Table Statement to ERD Visio Diagram
I have the following Create table statement from SQL Developer and I am trying to generate an ERD Diagram using 2003 Visio. I was wondering what I need to do to convert the Create Table to an ERD Diagram Using Visio. Thanks
CREATE TABLE “TT_TEAM”.”HR_REVOKED_SECURITY_ORGS”
“ID” NUMBER NOT NULL ENABLE,
“ACAT_CODE” VARCHAR2(6 BYTE) NOT NULL ENABLE,
“APPR_SEQ_NO” NUMBER(3,0) NOT NULL ENABLE,
“USER_ID” VARCHAR2(30 BYTE) NOT NULL ENABLE,
“ACTION_IND” VARCHAR2(1 BYTE) NOT NULL ENABLE,
“ACTIVITY_DATE” DATE NOT NULL ENABLE,
“COAS_CODE” VARCHAR2(1 BYTE),
“ORGN_CODE” VARCHAR2(6 BYTE),
“POSN” VARCHAR2(6 BYTE) NOT NULL ENABLE,
“MANDATORY_APPR_IND” VARCHAR2(1 BYTE),
“APPR_POSN” VARCHAR2(6 BYTE),
“ORGN_MANAGER” VARCHAR2(6 BYTE) NOT NULL ENABLE;I'm pretty Visio is a non-Oracle product.
In the mean-time, you can easily import a DDL script file and create a relational model/diagram using SQL Developer. Use the Import feature and point to your CREATE TABLE script(s) -
Create table statement inside a procedure.
Hi,
I'm trying to write a procedure creates some tables. The procedure has not arguments. I have written it in this way:
CREATE OR REPLACE PROCEDURE MIGRAZIONE
IS
var varchar2(2000);
BEGIN
--INIZIO tabella dominio spr_klers_bor_borsa
CREATE TABLE SPR_KLERS_BOR_BORSA34
ID VARCHAR2(4 BYTE) NOT NULL,
DESCRIPTION VARCHAR2(80 BYTE)
CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
(ID)
LOGGING
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
--FINE tabella spr_klers_bor_borsa
END MIGRAZIONE;When I compile I receive this message:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
What does it mean?
How can I solve?
I have tried to change the procedure in this way:
CREATE OR REPLACE PROCEDURE MIGRAZIONE
IS
var varchar2(2000);
BEGIN
--INIZIO tabella dominio spr_klers_bor_borsa
var := 'CREATE TABLE SPR_KLERS_BOR_BORSA
ID VARCHAR2(4 BYTE) NOT NULL,
DESCRIPTION VARCHAR2(80 BYTE)
CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
(ID)
LOGGING
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
execute immediate var;
--FINE tabella spr_klers_bor_borsa
END MIGRAZIONE;And when I compile the version above I receive:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
How can I solve?
Thanks all, bye bye.Here you have to user dynamic sql for create table, cerate index etc.
like
CREATE OR REPLACE PROCEDURE MIGRAZIONE
IS
var varchar2(2000);
BEGIN
--INIZIO tabella dominio spr_klers_bor_borsa
var := 'CREATE TABLE SPR_KLERS_BOR_BORSA
ID VARCHAR2(4 BYTE) NOT NULL,
DESCRIPTION VARCHAR2(80 BYTE)
Execute immediate var;
var := 'CREATE UNIQUE INDEX SPR_KLERS_IAZ_BORSA_PK ON SPR_KLERS_BOR_BORSA
(ID)
LOGGING
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL' ;
Execute immediate var;
var := 'ALTER TABLE SPR_KLERS_BOR_BORSA ADD (
CONSTRAINT SPR_KLERS_IAZ_BORSA_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE FIN_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
execute immediate var;
--FINE tabella spr_klers_bor_borsa
END MIGRAZIONE;YOu can specify all the ddl statements in one execute immediate.
Edited by: s_2 on Oct 17, 2008 6:59 PM -
SQLPLUS - Create Table statement
Hello gents/ladies.
I have a few tables that I want to import from a DUMP file I have from MySQL. My quickie question : I've removed all the MySQL specific formatting ( I thought ) like Type=MYISAM and similar, and ended up with a CREATE TABLE statement that looks like this:
CREATE TABLE customerdetails (
custid NUMBER(11) NOT NULL auto_increment,
uid_system varchar2(20) NOT NULL default '',
pwd_system varchar2(20) NOT NULL default '',
lastname varchar2(30) NOT NULL default '',
firstname varchar2(30) NOT NULL default '',
middleinitial char(1) default NULL,
day_phone_countrycode char(3) default NULL,
day_phone_main varchar2(16) default NULL,
evening_phone_countrycode char(3) default NULL,
evening_phone_main varchar2(16) default NULL,
email_primary varchar2(80) NOT NULL default '',
email_secondary varchar2(80) default NULL,
street_adress varchar2(80) NOT NULL default '',
state_prov char(3) NOT NULL default '',
zipcode varchar2(11) NOT NULL default '',
countrycode char(3) NOT NULL default '',
PRIMARY KEY (custid),
UNIQUE KEY UC_custid(custid),
UNIQUE KEY IDX_system_uid(uid_system),
KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
I get this error back from SQLPLUS:
CREATE TABLE CUSTOMERDETAILS (
ERROR in line 1:
ORA-00922: missing or invalid option
I've read through the documentation, and can't see what I'm missing here. Could somebody PLEASE point out the obviously screaming error in this statement?
Thanks!
Kind regards,
Henning Kilset Pedersen
Funcom OSLO ASHi Henning Pedersen,
First of all the your query syntax is wrong.
1. the keyword you used "auto_increment" is not in oracle. you need to take it out from query.
2. you are saying some columns are not null but giving default value as '' (two quotes without any space), this is contradiction, since '' is null, this gives you an error.
Need to take it out.
3. the keyword UNIQUE KEY is wrong you need to use only UNIQUE.
4. Another option is not correct it UNIQUE KEY IDX_system_uid(uid_system),
it must be UNIQUE (uid_system)
5. There is not any keyword as a KEY in oracle. you need to take it out from the query too.
The final query will be like :
CREATE TABLE customerdetails (
custid NUMBER(11) NOT NULL ,
uid_system varchar2(20) NOT NULL ,
pwd_system varchar2(20) NOT NULL ,
lastname varchar2(30) NOT NULL ,
firstname varchar2(30) NOT NULL ,
middleinitial char(1) default NULL,
day_phone_countrycode char(3) default NULL,
day_phone_main varchar2(16) default NULL,
evening_phone_countrycode char(3) default NULL,
evening_phone_main varchar2(16) default NULL,
email_primary varchar2(80) NOT NULL ,
email_secondary varchar2(80) default NULL,
street_adress varchar2(80) NOT NULL ,
state_prov char(3) NOT NULL ,
zipcode varchar2(11) NOT NULL ,
countrycode char(3) NOT NULL ,
PRIMARY KEY (custid),
UNIQUE (custid),
UNIQUE (uid_system)---,
---KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
---KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
This would work fine.
Thanx
Arvind.
null -
What wrong in this create table statement ?
CREATE TABLE FORM_CONTACT_DETAIL (
FORM_DETAIL_ID NUMBER (7) NOT NULL,
CONTENT_ID NUMBER (7) NOT NULL,
WEBSPACE_ID NUMBER (7) NOT NULL,
COMPANY_NAME VARCHAR(100),
JOB_TITLE VARCHAR(50),
POSITION VARCHAR(50),
TITLE VARCHAR2 (8),
FIRST_NAME VARCHAR2 (100),
MIDDLE_INITIAL CHAR (2),
LAST_NAME VARCHAR2 (100),
SUFFIX VARCHAR2 (8),
ADDRESS1 VARCHAR2 (50),
ADDRESS2 VARCHAR2 (50),
CITY VARCHAR2 (50),
STATE CHAR (2),
ZIP VARCHAR2 (8),
COUNTRY VARCHAR2 (3),
AREA_CODE_1 VARCHAR2 (3),
HOME_PHONE_1 VARCHAR2 (40),
AREA_CODE_2 VARCHAR2 (3),
HOME_PHONE_2 VARCHAR2 (40),
FAX_AREA_CODE VARCHAR2 (3),
FAX_PHONE VARCHAR2 (40)
EMAIL_ADDRESS VC
OPT_OUT CHAR (1),
COMMENTS VARCHAR2 (500),
EMAIL_NEWSLETTER CHAR(1),
DATE_INSERTED DATE,
DATE_UPDATED DATE,
FORM_TYPE_ID NUMBER(7) NOT Null,
TRACKING_ID VARCHAR(255),
CONSTRAINT PK_FORM_CONTACT
PRIMARY KEY ( FORM_CONTACT_ID )
CONSTRAINT FK_FORM_CONTACT
FOREIGN KEY ( FORM_TYPE_ID )REFERENCES FORM_CONTACT_TYPES(FORM_TYPE_ID) );
The following error has occurred:
ORA-00922: missing or invalid optionThanks ps there is one more comma missing and the removal of blank line as u suggested created the table.
-
Funktion for "Create Table" Statement
Dear all,
I am looking for a function to create a "create table"-SQL statement from an existing SAP Dictionary table. Does anybod y know a abap function to do this. With the SQL Statement I want to create the table in an external Database.
Kind Regards
Roman BeckerHi please enter db_create* in se37 and pick the desired function needed.
here are few Function modules for u.
DB_CREATE_TABLE
DB_CREATE_TABLE_AS_SELECT
DB_CREATE_TABLE_AS_SELECT_S
DB_CREATE_TABLE_S As DB_CREATE_TABLE, also returns the generated statements
Satish -
Hi,
I am facing the following problem:
Database A is running with a great number of tables.
Database B should contain the same tables as A with different data (DB B is empty at the moment).
Therefore I've collected all the 'create table'-statements and packed them into a script.
Because there are several foreign key constraints in DB A (not all deferrable) it seems to be a problem to execute the script.
I have searched the internet how to disable constraints before executing the statements, but I' ve only found solutions for disabling constraints for allready existing tables - not disabling constraint checks will creating.
So, could you please give me a hint what keywords I should use for my further search?
Thanks in advance.steve sastro wrote:
Thanks to all of you.
The point is: I don't really like tools (where I have to click in GUIs). I prefer to see what's going on - just to learn what's happening behind.
As soon as I have tested all of your topics I will reward you with the forum-points. Thx again.
EDIT: Version is 10g
Edited by: steve sastro on 07.12.2009 11:28Being an old-fart command line guy myself, I can appreciate that -- up to a point. But eventually it gets to be simply re-inventing the wheel.
Use exp at the command line. Then use the 'strings' command to examine the output .dmp file. That will give you the education you seek. -
Creating table statement gets stuck
Hi everyone, i can use "select" statements without any problem but when i want to create a table with 100-1000 rows, it gets stuck and never returns and after i close the sql navigator and restart it, it creates my table easily but after 20-30 seconds when i want to create an another table, it stucks again. What can be the problem??(At the first times that i use sql, there was no problem)
Hi,
It's a bit difficult to answer. Members will try to help you about database problems but in this case it's impossible to know if it is a database problem. If you have the needed system privileges and some quota on a tablespace there is no reason you wouldn't be able to create tables in an Oracle database !
Ask your DBA to try directly with SQL Plus but if he confirms it's OK there is a problem with your SQL Navigator tool.
Best regards
Phil
Maybe you are looking for
-
Hi I'm using Mozilla 7.0.1 Today I got Mozilla crashed, and during the reopening, it crashed the second time. After reopening it second time, it showed me only "about:home" tab. At last, I lost my previous session - about 50 tabs. History -> "Restore
-
How do I make one while loop that runs 1 piece of data at a time?
I have a question about a while loop. Currently, I have 4 or 5 dynamic data lines that I would like to run through a while loop that will tell me if the data is within a certain range or not. However, the ranges are different for each piece of data
-
My camera Canon G3 (i know it's old) no longer connects to iPhoto (8.1.2) on my iMac, I have checked with my friends iMac same model iPhoto version and it works fine using my cable, I would appreciate any help getting this sorted
-
Help with very advanced slideshow using imovie?/idvd?/iphoto?
I am trying to create a more advanced slideshow for the first time, and I need some advice on how to manage my project and the order in which to use (if to use) the various applications (iphoto, idvd, imovie). I've been in all of them trying to figur
-
Will the iPod Touch 4th Generation get any other updates beyond 6.1.3?
Will the iPod Touch 4th Generation get any other updates beyond 6.1.3? Also my dad's iPad which is a 2nd Generation got the ios 7 update and also the fact is my iPod touch 4th Generation is alot newer than my dads ipad Will my 4th generation get any