Create Table Temp As Select * from Table

What happens in the backend (performance point of view) when we create a table as follows:
Create Table Temp As Select * from Table1;
Suppose that the table Table1 has 10 million rows.
How is this different from inserting 10 million rows using Insert Statement in a script etc. into Temp table.
i.e. insert into temp values(1, 'description', sysdate);

>
Create Table Temp As Select * from Table1; is always faster than inserting different rows using insert scripts.
>
Incorrect - not sure where you got that information.
The two things being talked about that can affect performance are the use of direct-path loads and whether those loads are logged.
It makes no difference if the table is created first and then loaded using INSERT or if a CTAS is used to do both.
A traditional INSERT can use the APPEND hint to perform a direct-path load.
>
Cretae table Temp As select * from Tabl1 does not generate logging to the database.Also as datatypes are determined automatically ,there is less work up front.
>
The statement that CTAS 'does not generat logging' is incorrect. Whether logging is generated depends on whether the table is in LOGGING or NOLOGGING mode. A CTAS does not automatically, on its own bypass logging.
To bypass logging and existing table can be set to NOLOGGING mode
ALTER TABLE myTable NOLOGGINGAnd for CTAS the mode can be specified as part of the statement
Create table Temp NOLOGGING As select * from Tabl1;

Similar Messages

  • Table structure changes when using 'create table X as ( select * from X@remote_server )'

    I need to create and copy data from a remote Oracle server to a local server. The command I use is
    create table X as ( select * from X@remote_server )
    with remote_server is the tns name of the remote Oracle server.
    The local table is created and populated with data as expected but when I check the structure using 'desc X' it shows me all the CHAR fields of the local table are triple as large as of the remote table.
    I guess the problem is the difference  between the NLS_CHARACTERSET settings . The local charset is AL32UTF8 and the remote is  WE8MSWIN1252.
    How do I change the command to make the two tables have the same field sizes ?
    Thanks,
    Vu

    Do you want to be able to store all the data from the remote table in the local table?  Assuming you do, increasing the size of the column would be the correct behavior.
    By default, a VARCHAR2(10) allocates up to 10 bytes of storage.  In the Windows-1252 character set on the source, 1 character requires 1 byte of storage.  So a VARCHAR2(10) has space for up to 10 characters.  In the UTF-8 character set on the destination, however, 1 character can require up to 3 bytes of storage.  So a VARCHAR2(10) may allow you to store as few as 3 characters.  Since Oracle has no way of knowing what data you have (and will have) in the source system, it triples the size to ensure that all the data from the remote system will fit in the new table.  If you want the columns to be the same size on the destination that they are on the source, it is highly probable that you'll get errors inserting the data because at least one value will be too large for the destination column.
    Justin    

  • CREATE TABLE A AS SELECT * FROM B WHERE 1 = 2'-Queries

    Guys,
    I request your guidance in the effect of Create table statement below:
    CREATE TABLE A AS SELECT * FROM B WHERE 1 = 2';
    Question:
    1)What would be the PCTFREE value for table A-Would it inherit PCTFREE from table B?
    2) Will table A be created with LOGGING or NO LOGGING?-Will it iinhert the same from table B?
    3) What would be the degree of parallelism of table A?-Will it inherit the DOP from B?
    Thank you very much for your guidance in advance..
    Regards,
    Bhagat

    1 => it will inherit from the default value
    2 => same thing
    3 => same thing
    The create table as select will only copy the structure of the source table and can copy the datas too. That is all.

  • Html form for select * from table a

    Hi all,
    I m looking for report on header/footer part from one apex pages
    which will display context from table a, like sql statement
    select * from table a, written in html.
    Is any examples in java script/html select from tables
    (and same insert into table A (...) select * from table b)
    thanks,
    Gordan

    Hello Gordan,
    Do you want to show the whole report or just some data of it?
    If it's for ex just the name and address you could create two items and have a process or computation to fill it with your select statement.
    If it's the whole report, just create the report and put it in for ex. Region 1. In your page template you can specify that Region 1 needs to come into the footer.
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

  • How do I do SELECT * FROM TABLE WHERE KEY IN ({list})?

    The title says it all really.
    Is there a reasonable performant way to perform the query
    SELECT * FROM TABLE WHERE KEY IN ({list})where {list} is String []?
    I am currently creating a PreparedStatement with a for loop like this   StringBuffer sb = new StringBuffer ("SELECT * FROM TABLE WHERE ID IN (");
      for (int ii=0;ii<keys.length;ii++) {
        sb.append (keys [ii]);
        if (ii != keys.length-1) sb.append (",");
      sb.append (")");but this means that the prepared statement is created each time I call my method and so I'm not sure that the optimizer will find it easy to cope with. Is there a construction that I'm missing along the lines of SELECT * FROM TABLE WHERE KEY = ? where I can create the PreparedStatement once and just call setObject or something on it when the values in {list} change?

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • Select from table containing clob

    If i try to select from table containing clob column in SQL PLus it gives error.
    Tab1 contains 3 clob columns and 1 blob column
    select * from tab 1;
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    The same statement works in SQL Developer and I am able to see the result.
    Actually i am writing the queries and they will be used by Java developers in their JSP page.
    So what happens here? Can Java use these select statements or will it throw error like SQL Plus?

    BLOB column content can't be displayed in SQL*Plus:
    SQL> create table t_blob (b blob);
    Table created.
    SQL> edit
    Wrote file afiedt.buf
      1* insert into t_blob values('01')
    SQL> /
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t_blob;
    SP2-0678: Column or attribute type can not be displayed by SQL*PlusBlob and clob columns content can be processed using DBMS_LOB
    package procedures and functions or using client's language (like Java)
    methods. See JDBC specification.
    Rgds.

  • NO Links or Associations created with the "Business Components From Tables"

    Hello,
    I have a strange problem. I'm working on a Fusion Web Applicaiton. In the Model project, I try to create some Business Components from Tables with the help of the provided wizard.
    I select one of my IDE Connections, and I choose two of my tables as Entity Objects (*PATIENTS* and COUNTRIES - more details about them bellow), and also as Updatable View Objects. For Read-Only View Objects I select some other tables, afterwards I choose to create a default Application Module, and I press Finish without creating a Business Diagram. Everything works perfectly except of the fact that the wizzard has created everything but the Links and the Associations between my tables.
    To be more precise, COUNTRIES is a simple table, only two columns - ID and NAME, and PATIENTS has some columns like ID, NAME, ADDRESS, DATE_OF_ADMISSION, COUNTRY_ID, where COUNTRY_ID is a foreign key to the COUNTRIES table. Both columns, PATIENTS.COUNTRY_ID and COUNTRIES.ID are NUMBERs. I was expectig the wizard to create a Link and a Association for this foreign key constraint I have between this two tables.
    On the other hand, following one of the tutorials I've found, *"Developing RIA Web Applications with Oracle ADF"*, I've noticed that when I was creating Business Components from Tables based on the HR schema, all the Links and Associations were created as they were expected. I've also tried to create the same Business Components from Tables in my own project, and all the Links and Associations were in place. Somehow, it's not working for my particular schema (the one that contains PATIENTS and COUNTRIES).
    Is there something I do wrong? I've made sure that all the FK constraints are enabled, alive and kicking. From my point of view, the tables are working and behavig as they should, but I can't understand why that feature of automatically creating the Links and Associations works on the HR schema but not on mine.
    Please help!
    Bogdan.
    PS: I am using Oracle JDeveloper Studio Edition Version 11.1.1.1.0, Oracle SQL Developer Version 1.5.5, and Oracle 10g Express Edition installed on localhost.

    Hello John,
    Of course I can post the scripts.
    The schema name is "TEST". But you should know that there are some extra columns in the PATIENTS table, I've not mentioned before. As you can tell from the scripts bellow, the PATIENTS table has the following columns: ID (number), NAME (varchar2), COUNTRY (number), GENDER (number), ADMISSIONDATE (date), DIAGNOSTIC (number), FIRSTNAME (varchar2), SALARY (number). There are actually 3 FK constraints, I've only mentioned one for the simplifying the example. The first FK constraint is towards COUNTRIES, the second one is towards GENDERS, and the final one is towards DIAGNOSTICS. All this 3 tables have only two columns (ID as number, and GENDER as varchar2). I will post the scripts for all.
    Here is the output of the Export DDL to Clipboard from SQL Developer for the COUNTRIES table:
    CREATE TABLE "TEST"."COUNTRIES"
    (     "ID" NUMBER NOT NULL ENABLE,
         "NAME" VARCHAR2(1000 BYTE) NOT NULL ENABLE,
         CONSTRAINT "COUNTRIES_UK1" UNIQUE ("NAME")
    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 "COUNTRIES_PK" PRIMARY KEY ("ID")
    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
    ) 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" ;
    CREATE UNIQUE INDEX "TEST"."COUNTRIES_PK" ON "TEST"."COUNTRIES" ("ID")
    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" ;
    CREATE UNIQUE INDEX "TEST"."COUNTRIES_UK1" ON "TEST"."COUNTRIES" ("NAME")
    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" ;
    CREATE OR REPLACE TRIGGER "TEST"."COUNTRIES_TRG"
    BEFORE INSERT ON COUNTRIES
    FOR EACH ROW
    BEGIN
    SELECT COUNTRIES_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
    END;
    ALTER TRIGGER "TEST"."COUNTRIES_TRG" ENABLE;
    Here is the same output for the GENDERS table:
    CREATE TABLE "TEST"."GENDERS"
    (     "ID" NUMBER NOT NULL ENABLE,
         "NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         CONSTRAINT "GENDERS_PK" PRIMARY KEY ("ID")
    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 "GENDERS_UK1" UNIQUE ("NAME")
    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
    ) 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" ;
    CREATE UNIQUE INDEX "TEST"."GENDERS_PK" ON "TEST"."GENDERS" ("ID")
    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" ;
    CREATE UNIQUE INDEX "TEST"."GENDERS_UK1" ON "TEST"."GENDERS" ("NAME")
    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" ;
    CREATE OR REPLACE TRIGGER "TEST"."GENDERS_TRG"
    BEFORE INSERT ON GENDERS
    FOR EACH ROW
    BEGIN
    SELECT GENDERS_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
    END;
    ALTER TRIGGER "TEST"."GENDERS_TRG" ENABLE;
    Here is the same output for the DIAGNOSTICS table:
    CREATE TABLE "TEST"."DIAGNOSTICS"
    (     "ID" NUMBER NOT NULL ENABLE,
         "NAME" VARCHAR2(1000 BYTE) NOT NULL ENABLE,
         CONSTRAINT "DIAGNOSTICS_PK" PRIMARY KEY ("ID")
    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 "DIAGNOSTICS_UK1" UNIQUE ("NAME")
    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
    ) 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" ;
    CREATE UNIQUE INDEX "TEST"."DIAGNOSTICS_PK" ON "TEST"."DIAGNOSTICS" ("ID")
    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" ;
    CREATE UNIQUE INDEX "TEST"."DIAGNOSTICS_UK1" ON "TEST"."DIAGNOSTICS" ("NAME")
    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" ;
    CREATE OR REPLACE TRIGGER "TEST"."DIAGNOSTICS_TRG"
    BEFORE INSERT ON DIAGNOSTICS
    FOR EACH ROW
    BEGIN
    SELECT DIAGNOSTICS_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
    END;
    ALTER TRIGGER "TEST"."DIAGNOSTICS_TRG" ENABLE;
    And finally, here is the same output for the PATIENTS table:
    CREATE TABLE "TEST"."PATIENTS"
    (     "ID" NUMBER NOT NULL ENABLE,
         "NAME" VARCHAR2(1000 BYTE) NOT NULL ENABLE,
         "COUNTRY" NUMBER,
         "GENDER" NUMBER,
         "ADMISSIONDATE" DATE,
         "DIAGNOSTIC" NUMBER,
         "FIRSTNAME" VARCHAR2(1000 BYTE),
         "SALARY" NUMBER,
         CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("ID")
    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 "PATIENTS_UK1" UNIQUE ("NAME", "ID")
    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 "PATIENTS_GENDERS_FK1" FOREIGN KEY ("GENDER")
         REFERENCES "TEST"."GENDERS" ("ID") ENABLE,
         CONSTRAINT "PATIENTS_DIAGNOSTICS_FK1" FOREIGN KEY ("DIAGNOSTIC")
         REFERENCES "TEST"."DIAGNOSTICS" ("ID") ENABLE,
         CONSTRAINT "PATIENTS_COUNTRIES_FK1" FOREIGN KEY ("COUNTRY")
         REFERENCES "TEST"."COUNTRIES" ("ID") 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" ;
    CREATE INDEX "TEST"."PATIENTS_INDEX1" ON "TEST"."PATIENTS" ("NAME")
    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" ;
    CREATE UNIQUE INDEX "TEST"."PATIENTS_PK" ON "TEST"."PATIENTS" ("ID")
    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" ;
    CREATE UNIQUE INDEX "TEST"."PATIENTS_UK1" ON "TEST"."PATIENTS" ("NAME", "ID")
    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" ;
    CREATE OR REPLACE TRIGGER "TEST"."PATIENTS_TRG"
    BEFORE INSERT ON PATIENTS
    FOR EACH ROW
    BEGIN
    SELECT PATIENTS_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
    END;
    ALTER TRIGGER "TEST"."PATIENTS_TRG" ENABLE;
    If a complete DB dump would be more helpful, please let me know. I am willing to provide any details.
    Thanks for your support.

  • Special Grant to use "Select * from Table(cast..."??

    Hi,
    I've recently created the types and function to use the Table(Cast(funtion) as type)). It works fine, and gives me the correct result. I've granted execute on the types and on the function to a role that is enabled for a user, but when the user tries to use the "select * from table(cast(function) as type))", he gets a "ORA-01031: Insufficient Privileges" error message. Is there any other grant that must be given to the role, so that the user can execute the select?
    Thanks in advance!
    Daniel

    Hi Kamal,
    I'm not sure what anonymous PL/SQL block means. When I (or the user) try to run the select, I enter all the information, i.e., the owners for the type and function: "select * from table(cast(a.my_function(my_argument) as a.my_type))". I'm trying to use SQLPlus at this time, and I have Oracle 8i.
    I didn't to explicitly grant execute to the user because that would go against some rules I have to follow... I'll se if I give it a try though!
    Thanks!

  • Expression Framework / SELECT * FROM TABLE(CAST(...

    Hello!
    Is it possible to build the following with Toplink Expression Framework?
    Example:
    CREATE TYPE TY_OB_TEST AS OBJECT
    ( SYSTOP_NR NUMBER(5,0)
    SYS_NR NUMBER(5,0)
    IM_SYS_NAME VARCHAR2(80) ) ;
    CREATE TYPE TY_TB_TEST AS TABLE OF TY_OB_TEST;
    Package1.FUNCTION1 returns Type TY_TB_TEST.
    SQL:
    select * from TABLE(CAST(PACKAGE1.FUNCTION1(42)) AS TY_TB_TEST ));
    thank you!
    Harald.

    Nope, just use SQL.
    - Don

  • Insert into table a (select * from table b) - need pk?

    Hi there.
    I'm going to insert into table FINAL (select * from table STAGING) - same structure but in STAGING the ID column has nulls.
    Do I need to provide the ID (primary key) for table FINAL or will it get created based on sequence/trigger?
    If I were doing this in a loop I'd get the next val from the sequence but on a simple insert, I'm curious.
    thanks!

    hmm.. what is ?
    it didn't like it.
    Error(11,4): PLS-00103: Encountered the symbol "[" 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>    <a double-quoted delimited-identifier> <a bind variable> <<    close current delete fetch lock insert open rollback    savepoint set sql execute commit forall merge    <a single-quoted SQL string> pipe
    9i, sqldeveloper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to achieve that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND n"

    How to achieve the SQL like that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND name = 'Will' " with BDB C-API
    The primary key in the primary database is 'age' ,and the secondary key in the secondary index is 'name' ,in a lot of examples ,there are all simple , but how to do that complex one.thx~

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • Is select from view faster then select from table..???

    Hello Gurus,
    I want to query some data from two tables, both of table have many columns (attributes) and many rows...
    I use several where clauses to retrieve data from those tables..
    witch one is faster, I create a view or I just "select" from those tables???
    Regards.
    Nia...

    riedelme wrote:
    3360 wrote:
    riedelme wrote:
    Selecting through a view almost never helps performance and frequently hurts.Views do not affect performance.
    Views are simply queries and like queries there are fast and slow ones.I disagree.
    First of all, to use a view you are executing a query to get a result set, then accessing the data from that result set - a built-in extra step to perform to get data.First of all that entire explanation of how views work is not correct. The optimizer will rewrite the query to make the view go away if possible.
    SQL> create or replace view v as select * from dual;
    View created.
    SQL> explain plan for select * from dual where dummy = 'X';
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 272002086
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DUMMY"='X')
    13 rows selected.
    SQL> explain plan for select * from v where dummy = 'X';
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 272002086
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DUMMY"='X')
    13 rows selected.Exactly the same.
    >
    Second, when accessing the data from the view the result sets don't have indexes for fast lookups and efficient joins on later steps.This is also known as just making stuff up and is not how the database works. care to share any references at all for any of this?
    >
    Third, the systems I've seen that use views extensively - I am looking at one now - tend to perform joins on views using the same tables with the same data over and over. This is a design issue and not specifically a problem with views but they lend themselves to this misuse much too easilyCorrect as I said a view is just a query, and just like queries there are good fast views and bad slow views
    >
    I'll concede that the problem is not specifically with views themselves but as I just said they lend themselves to misuse. Tuning views of views and views joined to views is difficultYes, queries can be misused as can almost all SQL functions and functionality.
    As I said - Views are simply queries and like queries there are fast and slow ones.
    Nothing that you have posted that is accurate changes that.

  • Xmlgen.getxml("select * from table") returns null pointer exception

    I am running oracle 8i on solaris server and clinet on windows
    NT and i am this select statement
    select xmlgen.getxml("select * from table") from dual ,its
    returning null pointer exception,i have tried it through
    jdbc,even then its returning xml as
    <?xml version = '1.0'?>
    <ERROR>java.lang.NullPointerException</ERROR>
    can any body tell me the error.Help will be really appreciated.I
    need an urgent response,if some one can guide me please.
    My email is [email protected],if you can give me a quick
    response on this email,your effot will be appreciated.
    thanks
    Masood

    What is actually throwing the NullPointerException? rs.getMetaData() or table.setModel()?

  • Select * from table not working with Oracle OBDC driver

    Hello,
    In our web development we have been using the MS ODBC for Oracle
    driver to connect to our Oracle db. We decided to try the
    Oracle ODBC driver because it supports the commandTimeout
    property in ASP which the MS driver does not. The problem I'm
    running into now is that all of our select * from table
    statements appear not to be working. The Oracle ODBC driver
    version we are using is ver 8.00.05.00. Is there something that
    I'm not doing properly? If I take the same select * from table
    statement and name the columns, I dont get any error. Otherwise
    I'm getting a Subscript out of range error. It seems strange to
    me that this driver would not support a select * from table
    statement (which I''m told is the case by another developer
    here).
    Is there something I'm missing?
    Thanks,
    Pete

    I'm positive I have a connection. Otherwise I wouldn't get a
    response when I name the columns instead of using *.
    There must be something else that I'm missing or doing wrong.
    I've actually been looking into alternative ODBC drivers to see
    if I have the same problems but none that I have found support
    commandTimeout.
    Any other ideas?

  • Performace Which is better ?  : Bapi inside a loop OR Select from Tables

    Hi Gurus,
    I have a report which displays purchase info records.
    If I am selecting from tables i need to use EINA, EINE, EORD and some other tables.
    There is a BAPI which gets all purchase info records specific to a vendor , material , purchasing organisation.
    QUESTION: Performace wise which is the better Approach, either selecting from tables or BAPI for Purchase info records
    Regards
    Avi.

    Whether it using BAPI or select. you need to check the performance. If you have full key for these tables EINA, EINE, EORD  then mak a select outside of the loop and within loop use READ TABLE statement with binary search. of if you want multiple records within loop then use loop insdie loop.
    Your final objective is to minimise the database hits . If you use bapi inside loop then your database hits will be more
    select from EINA
    select from EINE
    select from EORD
    loop at itab,
      read table EINA
      read table EINE
      read table EORD
    endloop

Maybe you are looking for

  • Help required in RUEI 5.1 environment setup

    I am working on a customer demo and setting up the RUEI 5.1 environment. I am almost at the last stage of installation and trying to install the reporter software by using ruei-install.sh. it is installing the ux-collector package but giving error in

  • Can my Macbook Pro play HD-DVD or Blu-Ray?

    While installing Toast 8 onto my Santa Rosa Macbook Pro, the installer asked if I wanted to configure my mac to play Blu-Ray discs. I'm quite curious if my hardware is even capable...

  • Exporting synced audio with video for further editing

    I'm exporting DSLR footage with synced audio in order to "bake" the audio in. I'm going to bring the export into Prelude to organize and then back into Premiere to edit. What are the best export settings (including target and maximum bitrate) to main

  • Document archiving solutions

    Hi we have sharepoint 2010 farm and many users will upload documents daily  and we have plan to archive this documents and implement any archiving solutions what are the best archiving solutions that work perfect with sharepoint 2010 -i mean when any

  • Hot links open as blank tabs.

    When I click on a hot link on a web site, the page opens as a new tab, but is blank.