problem loading temporary table

Hi people

I have a problem when I need to create a temporary table

The temporary table will be loaded with the data of 7 identical paintings in all of 7 different databases

I need a way to identify the data of each database, the fields are all identical and theres not a single way to identity their

Any idea?

Thank you

Depends on how you load your temporary table.
But given your comment above, I assume you do 7 different INSERT using SELECT statements, reading the data through database links?
If this is the case, then simply select a constant in your selection:

insert into temp_table (
  database_id,
  col1,
  col2,
  col3
)
select
'DB1' as database_id,
col1,
col2,
col3
from table@db1
where ... ;

insert into temp_table (
  database_id,
  col1,
  col2,
  col3
)
select
'DB2' as database_id,
col1,
col2,
col3
from table@db2
where ... ;

...etc...

Tags: Database

Similar Questions

  • Global temporary Table problem in ADF

    Hello

    I have an application where I need to use a TWG (on the ranks of commit preserve) DB and try to insert data to TWG of screw ADF.
    But the table does not store data even after the Commit command. [Even I tried with permament DB table, and it worked.]

    Could someone help me find the problem with inserting data TWG.


    Kind regards
    Manju

    It is not a good idea to use a global temporary Table in an ADF application. The problem is that all web applications are really stateless. ADF maintains the State of a session data backup or reload it when necessary. Regarding the database, ADF can disconnect a session from the database at any time and connect to another session. This means that you do not necessarily have a continuous database session, then the lines you wrote to a TWG may well gone with the following query. There are ways to tell ADF not to do, but they have a considerable performance drop.

    Therefore, rethinking how you will save temporary information for the duration of a user session. You can do it in an object view ADF BC (VO) - interviewed by VO data carried session - if ADF needs to share a user session to load the data of another user (this is called "passivation") it will save these data. Then when ADF 'active' session, he'll find the saved data and reload it. Or you can use a permanent table with your name or session id - a little more complicated, but possible.

    If you want to tell us a little bit your use case - you need your application to do so, we may have other alternatives.

  • Common problem with temporary profiles being loaded

    I have a recurring problem with temporary profiles being loaded.  This problem appears more widespread when moving from one user to another.  Usually it is a user with administrative privileges to a user with admin rights, but also occurs when switching between non-Admin users.  Reboot allows profile to be loaded successfully.  I saw posts on what it needs to be done with a single corrupt profile, but have not seen anything about this type of persistent problem.

    Corruption of persistent profiles can be caused by 1) malware infection; (2) defective material. I would like to start by making a thorough analysis and then if the computer is clean, test the equipment. This last start by testing the RAM, then the hard drive.

    http://www.elephantboycomputers.com/page2.html#Removing_Malware

    http://www.elephantboycomputers.com/page2.html#Hardware_Tshoot

    MS - MVP - Elephant Boy computers - don't panic!

  • Problem loading table in SQL server

    Hello

    I'm trying to load a table in SQL server from another instance of SQL server.

    I defined the physical and and stores of data, logical and reverse engineered models to retrieve tables.

    The target table has been created manually...

    If I try to launch the interface I get the fololowing error


    ODI-1227: SrcSet0 (load) task fails on the source of connection MICROSOFT_SQL_SERVER data WAREHOUSE.
    Caused by: java.sql.SQLException: incorrect syntax [FMWGEN] [SQLServer JDBC Driver] [SQL Server] about ' < '.
    at weblogic.jdbc.sqlserverbase.ddb_.b (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb_.a (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb9.b (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb9.a (unknown Source)
    at weblogic.jdbc.sqlserver.tds.ddr.v (unknown Source)
    at weblogic.jdbc.sqlserver.tds.ddr.a (unknown Source)
    at weblogic.jdbc.sqlserver.tds.ddq.a (unknown Source)
    at weblogic.jdbc.sqlserver.tds.ddr.a (unknown Source)
    at weblogic.jdbc.sqlserver.ddj.m (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddel.e (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddel.a (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddde.a (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddel.v (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddel.r (unknown Source)
    at weblogic.jdbc.sqlserverbase.ddde.execute (unknown Source)
    at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)

    He tries to run the following SQl and I don't know why she strives to drop and create a view in the source system? The interface that I do turn above has only one source of target mapping...

    Delete the < Undefined > view. SQLDATAWH_DATAWAREHOUSEAccountDim

    Indications will be useful...

    Thanks in advance...

    Whirlpool says:
    Can you please let me know the name of the lkm and ikm which must be selected for SQL SERVER to SQL SERVER.

    You can see this
    http://docs.Oracle.com/CD/E23943_01/integrate.1111/e12644/ms_sqlserver.htm#BGBJBGCC

  • problem of global temporary table in different environment

    I have 2 environment
    production of 1) development) 2.

    developing oracle version is-
    ----------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0    Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    in prodcution
    -----------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0    Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    We use two global temporary tables (tmp_transaction tmp_category_mv)(development and production).
    Both are contains the same set of data. I compared the data set.all are the same.
    but the return of different query defined in the development environment.

    But instead of a global temporary table in the development, it returns the same result, defined as the production, I used a normal array.

    Please suggest me what I do?

    my query
    ===========
    select /*+ parallel(t,4) */
                t.transaction_id,
                cr.cat_rule_id,
                cr.apply_seq,
                t.site_id,
                cr.site_id cat_rule_site_id
            from
                tmp_transaction t
                    left outer
                    join tmp_category_mv cr on
                            (cr.data_feed_code is null
                            or t.data_feed_code = cr.data_feed_code)
       and (cr.min_date is null or t.transaction_date > min_date)
       and (cr.max_date is null or t.transaction_date < max_date)
       and (cr.local_commodity_code is null or t.local_commodity_code like cr.local_commodity_code)
       and (t.local_supplier_code = cr.local_supplier_code)
       and (cr.local_commodity_name is null or t.local_commodity_name like cr.local_commodity_name)
       and (cr.invoice_description is null or t.invoice_description like cr.invoice_description)
       and (cr.cost_centre_name is null or t.cost_centre_name like cr.cost_centre_name)
       and (cr.purchase_order_description is null or t.purchase_order_description like cr.purchase_order_description)
       and (cr.purchase_order_line_desc is null or t.purchase_order_line_desc like cr.purchase_order_line_desc)
       and (cr.gl_code is null or t.gl_code like cr.gl_code)
       and (cr.gl_name is null or t.gl_name like cr.gl_name)
       and (cr.material_group_code is null or t.material_group_code like cr.material_group_code)
       and (cr.material_group_name is null or t.material_group_name like cr.material_group_name)
       and (cr.material_code is null or t.material_code like cr.material_code)
       and (cr.material_name is null or t.material_name like cr.material_name);
    Published by: BluShadow on February 8, 2012 13:29
    addition of {noformat}
    {noformat} tags. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Hello

    Could be

    Bug 6193398: QUERY PARALLEL WITH an OUTER JOIN ON TEMPORARY DELIVERS INCORRECT RESULTS TABLE

    Database version 10.2.0.2.0

    Status 80 - development of Q / A

    WORKAROUND SOLUTION:
    - - - - - - - - - -
    Use the series query or table normal and not temporary.

    Concerning
    Peter

    EDIT: Status seems to be incorrect, in patch has been in 10.2.0.4

    No MOS?

    Published by: Peter on 8 February 2012 14:28

  • ODI CKM and LKM temporary tables

    Hello

    I am new to Oracle Data Integrator part.
    I've found that I have$ and C$ temporary tables are created in the schema target databases?
    I just wanted to know is there a significance that these tables are created in target tables?
    These tables can be created in the other schema schema target?
    If so, how they can b created?

    Really need this information ASAP?

    Thanks for the Clarification.

    Thank you and best regards,
    Mahesh

    Hello Manu,

    Good to know you well understood.
    If you make another schema then temporary tables will not be created in you're your target schema. Thus, it will be clean of temporary tables.

    You shoudn't make another database because when you deal with millions of records, you will face a huge problem in time to load application consumption.
    I was suffering with this scenario, but now I use the other as I told you before.

    Thank you

  • Temporary table already exists!

    I am trying to use the oracle.spatial.rdf.client.BatchLoader to load the triples in a semantic model. I get the following stack trace:

    Temporary table already exists!
    java.sql.SQLException: ORA-00955: name is already used by an existing object
    ORA-06512: at the 'MDSYS. SDO_RDF_INTERNAL', line 3326
    ORA-06512: at the 'MDSYS. SDO_RDF_INTERNAL', line 3362
    ORA-06512: at the 'MDSYS. RDF_APIS', line 786
    ORA-06512: at line 1

    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3839)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1085)
    at oracle.spatial.rdf.client.NTripleConverter.loadNTriple(NTripleConverter.java:391)
    at oracle.spatial.rdf.client.BatchLoader.main(BatchLoader.java:302)


    Unfortunately, it doesn't give me the offending table name so I can let it go. I was able to load the triplets in this way until I had to interrupt a charge midway through. If I try to run sem_apis.cleanup_batch_load as a user MDSYS, however, I get the following:

    ORA-13199: failed to load batch clean. ORA-00942: table or view does not exist
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. SDO_RDF', line 891
    ORA-06512: at the 'MDSYS. SDO_RDF', line 897
    ORA-06512: at line 1

    Once again, I don't have not provided the offending table name. Can someone please give an idea as to how I can solve this problem?

    PS: It would be useful if at least the code have not been obscured, so we could follow in these footsteps, especially given the lack of documentation and bugginess

    The problem is caused by an unsuccessful previous batch loading. To solve it,

    As MDSYS, drop the following table.
    SQL > drop mdsys. RDF_LINK$ _TEMPBM$;

    You can also use the batch charger in 2.0 adapter Jena. It will protect you from
    This kind of problems.

    About sem_apis.cleanup_batch_load, please cut & paste the command line
    you have used.

  • Error: problem loading user profile

    Original title: temporary user profile

    After having my count disconnected a black screen came up and I just pressed a button any. Now I thought that there was a problem loading my user profile and I have a temp. one. All my music, home page, Favorites etc disappeared and I have to keep my computer to keep the changes I've done or they will also be lost. I still have the programs on my computer but not on my profile.  My password still works for my user account, but that of all, help please!

    Hi herekittykitty,

    Try these steps and check the result.
    Step 1: Run Microsoft Fix it
    a. see http://support.microsoft.com/kb/947215
    b. click Microsoft fix and run successfully.
    c. restart the computer and check the difference.

    Step 2: If the problem persists, restore the computer to an earlier time
    a. Click Start, type system restore in the search programs and files.
    b. click on the system restore, click Run as administrator.
    (c) in the System Restore dialog box, click Next.
    d. Select a restore point from the list that is dated before the problem and then click Next.
    e. on her confirm your restore point window, click Finish.
    f. check if the problem persists.

    See which is the system restore?

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Are global temporary tables, a standard feature of Oracle?

    I apologize for introducing me to this community with what must seem like a very stupid question...

    I am a software developer, working on a product that uses Oracle as its database, specifically Oracle 11 g Enterprise Edition. Recently, I solved a problem of performance by converting an ordinary table into a global temporary table. Before my boss allows me to put this change in the product, it wants to be sure that global temporary tables are a standard part of Oracle, not something that the customer must install separately or pay extra for. (This is the first time that we never used them in our product, so I think that most of the team are not familiar with them).

    I know that Oracle has had global temporary tables since the last millennium, so if ever, they have been a feature of the premium, they are unlikely to be now, but the boss wants me to get independent confirmation of this.

    Thank you.

    Steve Pemberton

    Here you can see "feature availability by Edition":

    http://docs.Oracle.com/CD/E11882_01/license.112/e47877/editions.htm#DBLIC116

    TWG tables is not even mentioned, which means that they do not belong to the functional components are paid separately.

    One caveat - if you have an application that uses connection pooling, it is recommended to use ON COMMIT DELETE ROWS, not ON COMMIT PRESERVE ROWS

    (or always use explicitly "DELETE gtt_table" at the beginning), because otherwise a user of the application can display the data TWG who has previously made a second user of the application.

    Kind regards

    Zlatko

  • Campus solution 9.0: engine Application parallel treatment of the Instances of the temporary Table

    People,


    Hello. I'm working on 9.0 Solution on a University Campus. I'm working on the module of Community Campus. I face a problem like below:


    Campus Community > personal information > add/update a person


    I can type in all the information for a person successfully and save it with success. But what research, it does not return anything to PS user
    This is because the security of access to demographic data is not granted to the user. So, I put security as below:


    Step 1:

    Set Up AWAR > Security > Secure Student Administration > permissions list > access to demographic data: I have select permission list HCPPALL and EOEI9200 for the PS user

    Step 2:

    Set Up SACRED > Security > Secure Student Administration > process > access to demographics: the process to initialize the authorization indicates to the user PS process program is the Application Engine. The process name is MSK_CFG. The process is not successful and returns an error as below:

    Table or view does not exist. Has no SQL statement: Truncate Table USER.PS_MSK_CFG_TAO4.


    The above error is that of the motor parallel processing Application on instances of the temporary table. There are 2 modes: online and batch. I run it in 2 modes as below:

    Online mode:

    Step 1: Navigator PeopleTools > Public Services > Administration > PeopleTools Options: I change 3 to 4 for the Instance of the Temp Table total and online.
    Step 2: Create a new control ID Temp1 and execute processes on Navigator SetUp > Security > Secure Student Administration > process > process of demographic data. The MSK_CFG process runs successfully, but the output file contains the message:

    ATTENTION: Application request engine is not active! Suspended treatment!


    So I run of steps 3, 4 and 5 in Batch mode as below:

    Step 3: Navigator PeopleTools > Application Engine > application Application Engine > engine Application request Page > add a new control ID Temp1.
    Step 4: Run the MSK_CFG with Temp1 process again and get the error:

    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO5.

    Step 5: I change 4 to 5 navigator PeopleTools > Public Services > Administration > page PeopleTools Option for the Instance of the Temp Table total and online.

    Re-run the MSK_CFG process and get the error:

    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO6.

    I have increase by 5-6 for the temporary Table instance and re-run the MSK_CFG process and get the same error with incremental number:
    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO7.

    I have increase by 6 to 7 and re-run the MSK_CFG process and get the same error:
    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO8.

    The maximum is 99, I continue to adding 1 to the Temp table instances and run the MSK_CFG process. But get the same error with differentials 1 as below:

    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO9.
    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO10.
    ... ...

    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO99
    Table or view does not exist: Truncate table USER.PS_MSK_CFG_TAO.

    My question is:

    Because the engine of the application is not active with a new control ID Temp1 in online mode, I add the new control ID Temp1 in the Application engine page request but get the error above.  How to solve the error above to begin the process of MSK_CFG?

    Thanks in advance.

    People,

    Hello. The problem is solved by myself.

    The thing is that we need to open the MSK_CFG_TAO of the temporary Table in the application designer and build. After construction, the table PS_MSK_CFG_TAO and PS_MSK_CFG_TAO1 come in the database.

    MSK_CFG process runs correctly now. Personal information of search returns data successfully. Thank you.

  • Global temporary table in PL/SQL with XML

    Hello

    I have the impression that it is something strange or maybe I'm missing something basic.

    Step 1: Create a global Temp table that should not be specific transaction.

    create a global temporary table Temp01

    (

    NUMBER OF TICKET_ID

    , Varchar2 (10) of the REGION

    NUMBER OF THE YEAR

    , CO_ID VARCHAR2 (10)

    ) ON COMMIT DELETE ROWS.

    Step 2:

    My XML that goes as a parameter to a new function.

    < TICKET >

    < TICKET_ID > 38498051 < / TICKET_ID >

    the USA < REGION > < / REGION >

    < YEAR > 2014 < / YEAR >

    XYZ123 < CO_ID > < / CO_ID >

    < / TICKET >

    Step 3: Create a Stand Alone function:

    -drop function aagarwal.wr_creation;

    create or replace FUNCTION XML_FUNC

    (

    ret_msg out varchar2,.

    p_xmlval IN varchar2

    )

    RETURN varchar2

    is

    l_xmlval varchar2 (4000): = p_xmlval;

    V_CO_ID VARCHAR2 (10);

    V_CODE VARCHAR2 (10);

    BEGIN

    BEGIN

    INSERT INTO Temp01

    (

    TICKET_ID,

    REGION,

    BLEACHED,

    CO_ID

    )

    SELECT

    EXTRACTVALUE (XmlType (p_xmlval), "/ TICKET/TICKET_ID ') ID,.

    EXTRACTVALUE (XmlType (p_xmlval), "/ TICKET/REGION") REGION.

    EXTRACTVALUE (XmlType (p_xmlval), "/ TICKET per YEAR"),.

    EXTRACTVALUE (XmlType (p_xmlval), "/ TICKET/CO_ID ') CO_ID

    FROM DUAL;

    ret_msg: = 'SUCCESS';

    -SELECT CO_ID IN V_CO_ID of aagarwal. TEMP_STAGE_WR;

    -return ret_msg;

    EXCEPTION

    WHILE OTHERS THEN

    ret_msg: = sqlerrm;

    Return ret_msg;

    END;

    BEGIN

    SELECT CO_ID INTO V_CO_ID FROM Temp01;

    / * MERGE IN the site is

    With the HELP of aagarwal. TEMP01 T

    WE (T.co_id = se.code AND se.type_nm = ' TYPE' and se.src_nm = T.region)

    WHEN NOT MATCHED THEN

    INSERT (ID, SRCNM, CODE, TYPENM)

    VALUES (SHARED_SEQ. NEXTVAL, T.region, T.co_id, 'TYPE');

    -commit; */

    return ret_msg | "ACE" | v_co_id;

    END;

    END;

    /

    Fact - created function.

    NOTE: MERGE statement is blocked and if the function was created in sweetness.

    Step 4: Call the function

    declare

    l_out varchar2 (50);

    l_outr varchar2 (50);

    p_xml XMLTYPE.

    Start

    l_outr: = XML_FUNC (l_out, ' < TICKET >)

    < TICKET_ID > 38498051 < / TICKET_ID >

    the USA < REGION > < / REGION >

    < YEAR > 2014 < / YEAR >

    XYZ123 < CO_ID > < / CO_ID >

    (< / TICKET > ');

    dbms_output.put_line (l_outr);

    end;

    /


    Step 5: Check the value being inserted into the temporary Table:


    Select * from temp01;


    So far so good.

    THE PROBLEM:

    Now I want to tweek the XML_FUNC function above by uncommenting MERGE statement, which brings me to an error that is not differentiable:

    I.e. PL/SQL: ORA-00942: table or view does not exist in line on MERGE pointing to Temp01 statement.

    NOTE: I tested this Merge statement explicitly (as long as the execution of Stand Alone and also by calling via anonymous block PLSQL) and its absolutely perfect work. And SITE table exist.

    PS: I would be grateful, if there is a better way to write this code? I'm not a regular PLSQL developer and so badly can write the code of practice.

    Kind regards

    AAG.

    Using 11.2.0.3:

    Owner of all these three objects is DBA.

    Are you sure?

    After the release of:

    Select object_name, object_type

    of object

    where object_name in ('TEMP01', 'SITE', 'XML_FUNC');

    You must grant the explicit right to select on the table for the owner of the function if the owners are different.

    This works as expected for me (user DEV has all 3 items):

    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

    Logged in as dev

    SQL >

    SQL > create a global temporary table Temp01)

    NUMBER OF TICKET_ID 2

    3, Varchar2 (10) of the REGION

    4, NUMBER OF THE YEAR

    5, CO_ID VARCHAR2 (10)

    6)

    7. ON COMMIT DELETE ROWS.

    Table created

    SQL >

    SQL > create table site)

    Identification number 2

    3, srcnm varchar2 (10)

    4, code varchar2 (10)

    5, typenm varchar2 (10)

    6  );

    Table created

    SQL > create the sequence shared_seq;

    Order of creation

    SQL >

    SQL >

    SQL > create or replace FUNCTION XML_FUNC)

    2 p_xmlval IN varchar2

    3)

    4 RETURN varchar2

    5 is

    6 l_xmlval xmltype: = xmltype (p_xmlval);

    7. START

    8

    9 INSERT INTO Temp01

    (10)

    TICKET_ID 11,

    REGION 12,

    13 YEARS,

    CO_ID 14

    15)

    16. SELECT ID EXTRACTVALUE(l_xmlval, '/TICKET/TICKET_ID'),

    17 EXTRACTVALUE(l_xmlval, '/TICKET/REGION') REGION,

    18 EXTRACTVALUE (l_xmlval, ' / TICKET per YEAR ') YEAR.

    19 EXTRACTVALUE(l_xmlval, '/TICKET/CO_ID') CO_ID

    20 FROM DUAL;

    21

    22. MERGE IN site

    23. WITH THE HELP OF TEMP01 T

    (24)

    25 T.co_id = se.code

    26 AND se.typenm = 'TYPE '.

    27 and se.srcnm = T.region

    28)

    29 WHEN NOT MATCHED THEN

    30 INSERT (ID, SRCNM, CODE, TYPENM)

    31 VALUES (SHARED_SEQ. NEXTVAL, T.region, T.co_id, 'TYPE');

    32

    33 return "SUCCESS";

    34

    35 END;

    36.

    Feature created

    SQL >

    SQL >

    SQL > set serveroutput on

    SQL >

    SQL >

    SQL > declare

    2

    3 l_outr varchar2 (50);

    4

    5. start

    6

    7 l_outr: = XML_FUNC (')

    8 38498051

    9 USA

    10 2014

    11 XYZ123

    12    ');

    13

    14 dbms_output.put_line (l_outr);

    15

    16 end;

    17.

    SUCCESS

    PL/SQL procedure successfully completed

    SQL > select * from site;

    ID CODE TYPENM SRCNM

    ---------- ---------- ---------- ----------

    TYPE 1 USA XYZ123

  • Best practices temporary table

    Hello

    I have a temporary table, and this table is emptied (removal of table_name) several times daily using a procedure.

    I just wanted to know what the best practice is to manage this scenario taking into account the time of reading / the table space / all other advantages/disadvantages?

    Truncate and load.

    Or, if possible, use a MVIEW instead of the table...

  • temporary tables using interfaces in this

    What is the purpose of the temporary tables in all by performing interfaces
    someone explain to me the treatment

    Transformation of a CI mess up sliders SQL, that I recently discovered. A temporary table or a set of rows to retrieve the values you are looping on (if of course) can help solve this problem.

    If you mean App Engine treatment in general (as in the post above), it is especially to avoid a loop by line and the same action above and all over again, or to avoid having to put many large tables in 1 query (you can update some fields in various stages), for example support I want to update an amount for each person , then I could have one

    In most cases less capable version:
    -----------------------------------------------------
    DoSelect:
    %Select(EmplId)
    SELECT COST FROM your query
    Followed by:
    INSERT INTO My_Result
    SELECT * FROM my_table
    Where emplid = %Bind(Emplid)

    In most cases better:
    ------------------------------
    Step SQL:
    Insert into %Table(My_ExmplTMP) (EMPLID) SELECT EMPLID FROM your query
    Followed by:
    INSERT INTO My_Result
    SELECT * FROM Tbl my_table, Tmp %Table(My_ExmplTMP)
    Where Tbl.emplid = TMP. EmplId

  • Use two temporary tables to assign 'color' to the results of the data

    Hello world... Here's what I'm trying to do, any help is appreciated of course...

    Data and Tables in the example:

    I have 5 dishes, each course has 2 assignments.
    with Courses as (
     select 100 courseID from dual union all
     select 200 from dual union all
     select 300 from dual union all
     select 400 from dual union all
     select 500 from dual
    ), Assigns as (
     select 'test100' name, 100 courseID from dual union all
     select 'test100', 100 from dual union all
     select 'test200', 200 from dual union all
     select 'test200', 200 from dual union all
     select 'test300', 300 from dual union all
     select 'test300', 300 from dual union all
     select 'test400', 400 from dual union all
     select 'test400', 400 from dual union all
     select 'test500', 500 from dual union all
     select 'test500', 500 from dual
    )
    select assigns.name, assigns.courseID from courses
    inner join assigns on assigns.courseID = courses.courseID
    I need each assignment to get a color assigned to it according to its courseID. So my theory is that I have a temporary table with a list of colors; each courseID would be are they assigned a color, but my question is how can I assign each courseID a color without anything to join the temporary table? Once that each courseID has a color, I would join rights holders so that each assignment has a color associated with it according to its courseID.
    --Color table with 6 colors
    with Colors as (
     select 'red' color from dual union all
     select 'blue' from dual union all
     select 'yellow' from dual union all
     select 'green' from dual union all
     select 'purple' from dual union all
     select 'teal' from dual
    )
    I have a previous post on this topic, but I didn't do well explain and make a link to it would probably add to the confusion to this question... happy to delete this post if someone recommends.

    Thanks for any help! Running Oracle 11 g.

    Hello

    939920 wrote:
    I don't have the ability to store the courseID with colors...

    Can get it, or ask someone with the makeup of capacity change for you.

    Is the problem that you have more than 6 courses but you want to add color to them with only 6 colors, and it is unclear what courses can be included in the results of a given query?
    If so, you can do somehting like this:

    WITH     colors     AS
    (
         SELECT  'red' AS color_name     FROM dual UNION ALL
         SELECT  'blue'                FROM dual UNION ALL
         SELECT      'yellow'          FROM dual UNION ALL
         SELECT     'green'               FROM dual UNION ALL
         SELECT  'purple'          FROM dual UNION ALL
         SELECT     'teal'                FROM dual
    )
    ,     colors_plus     AS
    (
         SELECT     color_name
         ,     ROW_NUMBER () OVER (ORDER BY NULL) - 1     AS color_id
         ,     COUNT (*)     OVER ()                    AS color_cnt
         FROM     colors
    )
    ,     course_assigns     AS
    (
         SELECT  a.name
         ,     a.courseid
         ,     DENSE_RANK () OVER (ORDER BY  a.courseid)     AS course_num
         FROM          assigns          a
         INNER JOIN      courses      c     ON   a.courseid   = c.courseid     -- If needed
    )
    SELECT     ca.name
    ,     ca.courseid
    ,     cp.color_name
    FROM     course_assigns  ca
    JOIN     colors_plus       cp  ON   cp.color_id  = MOD ( ca.course_num
                                                 , cp.color_cnt
                                      )
    ;
    

    Typical power:

    AME      COURSEID COLOR_
    ------- ---------- ------
    test100        100 blue
    test100        100 blue
    test200        200 yellow
    test200        200 yellow
    test300        300 green
    test300        300 green
    test400        400 purple
    test400        400 purple
    test500        500 teal
    test500        500 teal
    

    It would be better if you could create a real table as colors_plus.

    If there are more than 6 separate courses in the output, then 2 or more courses can be coded in the same color, but no color will be used N times (N > 1) until all the colors have been used N-1 times.
    The assignment of courses coolors is arbitrary. Depending on how fancy you want to do this, you might want to do something more complicated. For example, you have 2 course with 10 lines of each and 5-course dinner with 1 row of each. The query above will have to assign the same color to 2 courses of differenct, and it can assign the color "blue" for 2 courses with 10 rows of each. The query above can be modified, if necessary, assign the colors in order of frequency, in order to ensure that two 10-line courses get different colors, and that the colors tend to be more evenly distributed. I'll leave that as an exercise. (Tip: use the frequency in the clause ORDER BY of DENSE_RANK.) To obtain the frequency, use the COUNT function analytical in a subquery. Why do you need a subquery? Discuss among you).

  • Global Temporary Tables and truncate

    Hi all

    I have SQL script like this. Firstly, it truncates the Temp_emp and then, it will load data from big_table.
    Whenever I run this script from the SQL prompt, the data inserted into the Temp_emp are doubled. What can be the reason. Am I missing something
    concert of temporary Tables and global Truncate?

    *. SQL file starts here *.

    BEGIN
    RUN IMMEDIATELY 'TRUNCATE TABLE Temp_emp;
    END;
    /

    INSERT INTO Temp_Temp
    SELECT col1, col2, col3, col4 col5
    Of
    (SELECT col1, col2, col3, col4 col5 FROM big_table bt
    WHERE bt. ROWID IN (SELECT MAX (ROWID) FROM big_table
    GROUP BY col1, col2)
    ) ;

    /

    *. SQL file ends here *.

    Thanks in advance,
    PAL

    Please remove the "/" after the insert in your sql script. It executes the same statement insert again. Therefore, the data are doubled.

Maybe you are looking for

  • How to recover emails from comcast to time machine

    I use Safire for browser and Comcast Xfinity to the e-mails and I have a folder named saved emails. I'm trying to find this file in order to recover a decade lost emails. I have a seagate backup drive and use Time Machine to back upward. I was able t

  • Get the error code (50) while the restore / update

    Hello. I recently had a problem with my iPhone 5 c whose parameters of the carrier completely dropped. I was recommended by my carrier themselves to restore the iPhone via iTunes to recover the carrier settings. Doing this, I was shocked to see "the

  • Via mozilla.cfg proxy settings

    Thus, it is my first foray in the world of config files and such so patient with me if I'm doing something completely wrong. I'm writing a mozilla.cfg file which will force the auto proxy detection. I used lockPref ("network.proxy.type", 4), but I ge

  • Photo of tasks - help w / Configuration for W530

    Hello world I look the W530 as my main computer for work and would like some advice on the ideal configuration. Main tasks: -Lightroom (heavy-duty) -Photoshop (use light-medium) -Internet browsing -Email The main components, sure I wonder are: 1 proc

  • HP Deskjet Ink Advantage 4515: HP Deskjet Ink Advantage 4515 Activation

    I recently bout a HP Deskjet Ink Advantage 4515.  Prints OK, but have had a lot of problem with scanning and copying.  In doing so, the scanner/copier locks into place.  I'm used to be able to solve the problem in enbling scan of the computer.  But e