Error while creating Global temp table

Hi,
I am very new to PL/SQL so please excuse my question. I have the below query . I have to get a count between the source table and various target tables. I am creating a global temp table to store the counts. I am getting the below error for my following query :
Thanks for the help,
Petronas
----Query----
set serveroutput on
Declare
nm1 varchar2(200);
nm2 varchar2(200);
cnt1 number;
cnt2 number;
diff number;
totdiff number;
Begin
nm1 := null;
nm2:= null;
cnt1:= 0;
cnt2 := 0;
diff := 0;
totdiff := 0;
create GLOBAL TEMPORARY TABLE diff ( name1 varchar(200), name2 varchar2(200), diff number);
select count(*) into cnt1
from users_staging;
select count(*) into cnt2
from PROD.users;
nm1 := 'users_staging';
nm2 := 'PROD.users';
diff := cnt1 - cnt2;
insert into diff values (nm1,nm2,diff);
select count(*) into totdiff
from diff
where diff> 0 ;
dbms_output.enable(10000);
dbms_output.put_line('# of tables where difference is > 0 ' ||totdiff);
end;
Encountered the symbol "CREATE" 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
<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
pipe

Hi,
"CREATE GLOBAL TEPORARY TABLE ..." is not a PL/SQL command; it is a SQL command only.
Create the table, using that statement, before running the PL/SQL block.
You can issue SQL statements from within PL/SQL using the EXECUTE IMMEDIATE command, but this is rarely a good idea.
I assume the PL/SQL code is meant to create the table and then populate it.
You should split those into two separate pieces of code. You'll only want to create the table once, no matter how many times you use it. I assume you'll want to populate it the same way many times. Remember, the "TEMPORARY" in "GLOBAL TEMPORARY TABLE" refers to the data, not the table. When you end a transaction (or a session, depending on whther you want "ON COMMIT DELETE ROWS" or "ON COMMIT PRESERVE ROWS"), the data disappears, but the now-empty stays, ready to be populated for the next transaction (or session).
Edited by: Frank Kulash on Aug 4, 2010 2:25 PM

Similar Messages

  • Error while creating the DWH tables using DAC

    Hi,
    I am getting error while creating the DWH tables using DAC. I have created a ODBC DSN using merant driver with DAC repository DB credentials and the test connection is successful. And while creating the tables i gave the olap dw credentials and the DSN name which i created earlier. But it throws the error as below:
    Please find the below mentioned error message
    =====================================
    STD OUTPUT
    =====================================
    CREATING SIEBEL DATABASE OBJECTS
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ******* /c DB_DAC /G "SSE_ROLE" /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b "" /K "" /X "" /W N
    Error while importing Siebel database schema.
    =====================================
    ERROR OUTPUT
    =====================================
    Siebel Enterprise Applications ODBC DDL Import Utility, Version 7.7 [18030] ENU
    Copyright (c) 2001 Siebel Systems, Inc. All rights reserved.
    This software is the property of Siebel Systems, Inc., 2207 Bridgepointe Parkway,
    San Mateo, CA 94404.
    User agrees that any use of this software is governed by: (1) the applicable
    user limitations and other terms and conditions of the license agreement which
    has been entered into with Siebel Systems or its authorized distributors; and
    (2) the proprietary and restricted rights notices included in this software.
    WARNING: THIS COMPUTER PROGRAM IS PROTECTED BY U.S. AND INTERNATIONAL LAW.
    UNAUTHORIZED REPRODUCTION, DISTRIBUTION OR USE OF THIS PROGRAM, OR ANY PORTION
    OF IT, MAY RESULT IN SEVERE CIVIL AND CRIMINAL PENALTIES, AND WILL BE
    PROSECUTED TO THE MAXIMUM EXTENT POSSIBLE UNDER THE LAW.
    If you have received this software in error, please notify Siebel Systems
    immediately at (650) 295-5000.
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ***** /c DB_DAC /G SSE_ROLE /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b /K /X /W N
    Connecting to the database...
    28000: [DataDirect][ODBC Oracle driver][Oracle]ORA-01017: invalid username/password; logon denied
    Unable to connect to the database...
    any help is appreciated.
    Thanks,
    RM

    The fact that you are getting an "ORA-01017: invalid username/password; logon denied" message indicates that you are at least talking to the database.
    The log shows that username "infdomain" is being used. Can you double check the username and password you have in DAC in a SQL*Plus/SQL Developer session?
    Please mark if useful/helpful,
    Andy.

  • Error while creating data warehouse tables.

    Hi,
    I am getting an error while creating data warehouse tables.
    I am using OBIA 7.9.5.
    The contents of the generate_clt log are as below.
    >>>>>>>>>>>>>>>>>>>>>>>>>>
    Schema will be created from the following containers:
    Oracle 11.5.10
    Universal
    Conflict(s) between containers:
    Table Name : W_BOM_ITEM_FS
    Column Name: INTEGRATION_ID.
    The column properties that are different :[keyTypeCode]
    Success!
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    There are two rows in the DAC repository schema for the column and the table.
    The w_etl_table_col.KEY_TYPE_CD value for DW application is UNKNOWN and for the ORA_11i application it is NULL.
    Could this be the cause of the issue? If yes, why could the values be different and how to resolve this?
    If not, then what could be the problem?
    Any responses will be appreciated.
    Thanks and regards,
    Manoj.

    Strange. The OBIA 7.9.5 Installation and Configuration Guide says the following:
    4.3.4.3 Create ODBC Database Connections
    Note: You must use the Oracle Merant ODBC driver to create the ODBC connections. The Oracle Merant ODBC driver is installed by the Oracle Business Intelligence Applications installer. Therefore, you will need to create the ODBC connections after you have run the Oracle Business Intelligence Applications installer and have installed the DAC Client.
    Several other users are getting the same message creating DW tables.

  • Error while creating publisher change tables in CDC

    Hi,
    I am implementing Change Data Capture. I got getting following error while creating publisher change tables in Staging database. My database version is 10.2.0.2.0 .
    I appreciate your help.
    ERROR at line 1:
    ORA-29540: class oracle/CDC/PublishApi does not exist
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 611
    ORA-06512: at line 2
    Thanks,
    Venkat.

    This problem got fixed when I ran below script!!
    @$ORACLE_HOME/rdbms/admin/initcdc.sql;

  • Error while creating datasource from table MBEWH

    Hi all,
    I am facing an error message while creating datasource from table MBEWH
    "Invalid extract structure template MBEWH of DataSource "; This operation failed, because the template structure quantity fields or currency fields, for example, field LBKUM refer to a different table.
    Can anyone help me that why system is not allowing me to generate generic datasource for table MBEWH to transfer my month wise inventory data.
    thanks and regards.

    Hi Zakir,
          This was comming for classification data... when ever you want to extract some classification related data then we can't create generic datasources  directly.. for that you need  to go with CTBW  ( tcode )  and   create  one datasource...
       so, you need to check that   related table also.. for that  MBEWH table..
        ALL THE CLASSIFICATION RELATED DATASOURCES WE CAN'T CREATE DIRECTLY... JUST LIKE  AUSP table also.. liek this..
    regards
    @jay

  • Error while creating Cross-reference table using Xreftool (PIP Ins)

    Error while running xref.sh script unable to create cross reference table.
    **Error: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/tip/xref/tool/AdminTool**
    Could not find xref directory within tip folder (/OracleAS_1/bpel/docs/workflow/oracle/tip)
    searched for similar issue in OTN it says issue fixed by upgrading Oracle AS, we are using 10.1.3.4 MLR#8
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=835446
    steps followed.
    Creating Cross-Reference Tables
    Complete the following procedure to create cross-reference tables.
    To create cross-reference tables
    1 Navigate to the following directory:
    %SOAHOME%/SiebelODOPPIP/scripts/
    2 Open the following file for editing:
    xref.sh
    3 Set the userid and passwd for logging into BPEL console on the appropriate lines.
    4 Set the correct SOA_HOME location on the appropriate line.
    5 Save and close the file.
    6 Make the file executeable:
    chmod +x xref.sh
    dos2unix xref.sh
    7 Change directory (cd) to integration/esb/bin under %SOAHOME%.
    8 Execute ../../../SiebelODOPPIP/scripts/xref.sh.
    I am using SOA suite 10.1.3.3 and getting same error
    Error: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/tip/xref/tool/AdminTool

    Hi Abhijeet,
    please check in transaction FI01, about your data consistencies. You can use this wiki help in terms of Address, it it found any useful facts for you
    Address Checks - Business Address Services (BC-SRV-ADR) - SAP Library

  • Error while creating oracle external table

    I am trying to create an external table with the following syntax. WhenI have executed this statement in my server which running in my machine, it is working fine. Whine I try to run the same statement on different server, it is giving the below error. I have verified the grants on both the schemas, they are simillar.
    create table ext_ORGBASIC_CLIENT1(
    Serial_Number varchar2(1000),
    Add_Edit_Organization varchar2(1000),
    Parent_Organization varchar2(1000),
    Organization_Code varchar2(1000),
    Organization_Name varchar2(1000),
    Legal_Entity varchar2(1000),
    Active varchar2(1000),
    Require_Entity_Use__as_Matchin varchar2(1000),
    Pass_On_Tax_On_Tax_To_Customer varchar2(1000),
    Allow_Exemption_Without_Receiv varchar2(1000),
    Entiy_Use_Code_Association varchar2(1000),
    Tax_Calculation_Type_Code varchar2(1000),
    Transaction_Type_Code varchar2(1000),
    Transaction_Source_Code varchar2(1000),
    Taxware_Delivery_Terms_Code varchar2(1000),
    Taxware_Mode_of_Transport_Code varchar2(1000),
    Debit_Credit_Indicator varchar2(1000),
    Discount_Type_Code varchar2(1000),
    Place_of_Principal_Negotiation varchar2(1000),
    Quantity_Unit_of_Measure_Code varchar2(1000),
    Good_Service_Category_Code varchar2(1000),
    Tax_Rate_Of_Geo_Code_To_Be_Aut varchar2(1000))
    organization external
    ( type oracle_loader default directory EXT_TAB_DIR
    access parameters ( records delimited by newline characterset US7ASCII load
    when (serial_number != 'Number' and serial_number != '#')
    badfile 'EXT_TAB_DIR':'CLIENT1.bad'
    logfile 'EXT_TAB_DIR':'CLIENT1.log'
    fields terminated by ',' optionally enclosed by '"' lrtrim missing field values are null
    reject rows with all null fields )
    location ('C_CLIENT1_TXWR_FS1_TWEBULK_ORGBASIC_1_1_20091126102230_001_CSV.csv') )
    parallel reject limit unlimited
    while querieng from the table I am getting the below error
    select * from ext_orgbasic_client1;
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04001: error opening file CLIENT1.log
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    I try to run the same statement on different server, it is giving the below errorSame OS name & version?
    Same Oracle version to 4 decimal places?
    Same OS file permissions?
    Same OS pathnames?

  • Error while creating dynamic internal table.

    Hello Expert,
    While creating a dynamic internal table, it throw an run time error as :
    " LOAD PROGRAM NOT FOUND
      CX_SY_PROGRAM_NOT_FOUND"
    i tried to debug the program, it found this error comes while calling
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    please anyone help me out to resolve this problem.
    what could be the reason of error? and how to avoid it?
    <REMOVED BY MODERATOR>
    thanks in advance.
    ~ shweta.
    Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PM

    Hi,
    Go through this program.
    Report z_dynamic.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>,
    <dyn_field>.
    data: dy_table type ref to data,
    dy_line type ref to data,
    xfc type lvc_s_fcat,
    ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
    perform get_structure.
    perform create_dynamic_itab.
    perform get_data.
    perform write_out.
    form create_dynamic_itab.
    Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = ifc
    importing
    ep_table = dy_table.
    assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
    create data dy_line like line of <dyn_table>.
    assign dy_line->* to <dyn_wa>.
    endform.
    Regards,

  • Sntax error when creating a temp table

    Hi All,
    I get a syntax error when I try to create a  temporary table using the below sql statement.
    create global temporary column table prc as table precipitation;
    The  table precipitation exists in the database under my ID.
    Could anyone please let me know what is wrong with the above statement.
    Thanks,
    Goutham

    Try:
    create global temporary column table prc like precipitation;
    or
    create global temporary column table prc as (select * from precipitation);
    Cheers,
    Jody
    (HANA SQL Reference Manual:  https://websmp201.sap-ag.de/~sapidb/011000358700000604922011)

  • Error while creating cust In table T078D, the entry VD01 is missing...

    Hi Gurus,
    I am new to SAP and have just installed SAP 4.7 on my laptop. While creating customer master, a message displays In table T078D, the entry VD01   is missing, and even for XD01 the same message is displayed. Can you guysplease help me with this?
    Thanks
    Shiva

    Hi,
    this looks like some customizing records are missing in your installation.
    Table T078D contains the transaction dependant field settings.
    This is in relation with customizing transaction OB20
    In that table, there should be at least 15 records with the corresponding table key
    FD01
    FD02
    FD03
    VD01
    VD02
    VD03
    WR01
    WR02
    WR03
    WR11
    WR12
    WR13
    XD01
    XD02
    XD03
    So, if you don't find why standard customizing records are not part of you installation, you may re-create such records with the above keys.
    Please note that all fields that are not part of the key should at least contains '.' character for each digits of each fields.
    eg: FAUSA is 40 digits long.
    FAUSA = '........................................'
    Hope this helps
    Regards
    Alain

  • ODI XML data server error while creating External databse tables.

    Hi,
    i am trying to create External database tables using XML data server.
    i am getting the following error,i have done this same thing for small xml files before.
    Java.sql.SQLException: ORA-00904: : invalid identifier
         at com.sunopsis.jdbc.driver.xml.bz.execute(bz.java)
         at com.sunopsis.jdbc.driver.xml.ca.execute(ca.java)
         at com.sunopsis.xmlfifth.b.u.a(u.java)
         at com.sunopsis.xmlfifth.b.bj.a(bj.java)
         at com.sunopsis.xmlfifth.b.bj.a(bj.java)
         at com.sunopsis.jdbc.driver.xml.u.a(u.java)
         at com.sunopsis.jdbc.driver.xml.u.g(u.java)
    Thanks,
    RK

    RK,
    With no details of how you configured the XML server, what were the parameters used in the configuration for using external database, etc, I dont know how much can someone help you.
    This is an Oracle error, so a few things that could be problematic with your "big" xml -
    1.) An element name could be of length > 30 characters (Oracle table name length limit is 30)
    2.) There are some special characters in the element name
    3.) Element name begins with a Number
    4.) Element name is an Oracle reserved word.
    This list can go on.

  • Java Error while Using GLobal Temporary Tables

    Hi,
    Am having a global temporary table in my application with ON COMMIT DELETE ROWS option.
    I use it in a procedure to remove previous records, populate new ones and return a ref cursor
    Am calling this procedure from a java bean. In this call, the procedure gets executed successfully but when i try to access the RefCursor Object, I get an SQL Exception that the object no longer exists.
    Here are some inputs for reference:
    My DB Call:
    cstmt = myConn.prepareCall ("{ call MYPACKAGE.GTT_PROCEDURE(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?)}");
    My RefCursor Access:
    rsRuleSet = (ResultSet)cstmt.getObject(11);
    The SQLException:
    java.sql.SQLException: ORA-08103: object no longer exists
    Please note that the SQLException shown as per Java Stack trace is on the line with the RefCursor Access
    If anybody has any idea, then do reply
    Thanks in Advance,
    Piyush

    A couple of thoughts...
    Have you tried calling this procedure from PL/SQL to verify that the REF CURSOR returned is valid?
    Is your Java application set to autocommit, or do handle transactions yourself. If the container is handling transactions, it may committing as soon as the stored procedure finishes running, which would clear your temp table.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Error while creating a partitioned table

    I am trying to create a table with 2 partitions but am getting the following error.
    Can someone please help out as to what is missing here..!!!
    PARTITION BY RANGE (to_char(to_date(log_date,'YY/MM/DD HH24:MI:SS'), 'DD'))
    ERROR at line 7:
    ORA-00907: missing right parenthesis
    create table dummy_logs
    application_id number,
    log_date date
    tablespace my_tspace pctfree 4
    partition by range (to_char(to_date(log_date,'yy/mm/dd hh24:mi:ss'), 'dd'))
    ( partition day01 values less than ('02'),
    partition day02 values less than ('03')
    PS: The partition is to be based on the day('DD') on which the row will be added.

    Nopes Adith, It didn't helped.
    I specifically need the whole clause
    to_char(to_date('07/07/11 08:06:02','YY/MM/DD HH24:MI:SS'), 'DD') as I need to extract the day field from the sysdate.
    and also, it works fine when I query it through dual.
    05:15:55 SQL> select to_char(to_date(sysdate,'YY/MM/DD HH24:MI:SS'), 'DD') from dual;
    TO
    12

  • Error while creating a temp queue (JMSException sayin .Destination dosnt ex

    i will just post part of my code
    Properties env = new Properties();
                        env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
                        jndiContext = new InitialContext();
                        queueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory");
                        queue = (Queue) jndiContext.lookup(queueName);
                   }catch (NamingException e) {
                        System.out.println("JNDI API lookup failed: " + e.toString());
                        System.exit(1);
                   try {
                        queueConnection = queueConnectionFactory.createQueueConnection();
                        queueSession = queueConnection.createQueueSession (false, Session.AUTO_ACKNOWLEDGE);
                        queueConnection.start();
                        queueSender = queueSession.createSender(queue);
                        requestMessage = queueSession.createTextMessage();
                                                                requestMessage.setText("does");
    /* The code works fine  till here , but below as soon as i say  replyQueue = queueSession.createQueue("todo"); , it says the destination dosenot exist. why isnt it creating  a temporary queue for me . Exception thrown is javax.jms.JMSException :
    This Destination Does Not Exist.
                        replyQueue = queueSession.createQueue("todo");
                                            Destination replyDestination = replyQueue;

    createTemporaryQueue() already creates a unique
    destination; you don't need to do anything else.
    Note as we discussed in the previous thread; you
    should not create a temporary destination per
    request; you should create 1 temporary destination
    per consumer/process and reuse it across requests;
    using a correlationID to match requests to
    responses.
    James
    http://logicblaze.com/
    Hello Mr.James,
    pleeeeeeeeeeeeeeease give me one example of how do i create only one temporary queue and differentiate resposes based on CorrelationID, i mean i am just not able to do it , i feel i will have to browse through entire queue matching for CorrelationId's, however u had earlier rejected this approach
    THEN HOW DO I MATCH RESPONSES IN TEMPORARY QUEUES TO MY REQUESTS BASED ON CORRELATIONID , PLEASE GIVE ME AN EXAMPLE

  • Global Temp Table Not found - SSIS

    I am facing below error while using global temp table in SSIS.
    [OLE DB Destination [78]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E37.
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E37  Description: "Table/view either does not exist or contains errors.".
    [OLE DB Destination [78]] Error: Failed to open a fastload rowset for " ##AGENTDTLS". Check that the object exists in the database.
    [SSIS.Pipeline] Error: component "OLE DB Destination" (78) failed the pre-execute phase and returned error code 0xC0202040.
    1) For data connection manager - Retain same connection is set to True
    2) Data Flow task - Delay Validation is set to True
    3) Destination Task - Using Temp Table - ValidateExternalMetadata is set to false.
    4) I am just using one data connection.
    5) before using the temp file I am checking if its exits and if yes drp it first and create it.
    Not able to understand the reason for failure.

    Why don't you use permanent table in tempdb?
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Maybe you are looking for