Execution of the different procedure to the variable...

Run the following procedure is different if I put the value of the P_LOT variable and use it in the first selection stmt (AS shown). Or if I replace it in the stmt with the value of the parameter directly. (that is, replace P_LOT with "2148" in the first select stmt). The instructions of output show that the value of the variable is correct. I use DB 11g R2. Help, please.



Set serveroutput on;
DECLARE
NUMBER OF P_FID;
P_LOT VARCHAR2 (10);
cuser_one varchar2 (25);
cuser_two varchar2 (25);
cuser_three varchar2 (25);
RecordCount number;

BEGIN - party executable begins here
P_LOT: = '2148';
P_FID: = 206247;
dbms_output.put_line (P_LOT);
SELECT Count (LOTNO) IN RecordCount
OF IQMS. TRANSLOG
WHERE TRANSLOG. LOTNO = P_LOT
AND FGMULTI_CUSER1 IS NOT NULL
AND FGMULTI_CUSER2 IS NOT NULL
AND FGMULTI_CUSER3 IS NOT NULL
AND ROWNUM < 2;

dbms_output.put_line (P_LOT);
dbms_output.put_line (RecordCount);

IF (CpteEnregistrement > 0) THEN

dbms_output.put_line ("'In the loop");

SELECT
FGMULTI_CUSER1, FGMULTI_CUSER2, FGMULTI_CUSER3
IN
cuser_one, cuser_two, cuser_three
Of
IQMS. TRANSLOG
WHERE TRANSLOG. LOTNO = "2148"
AND FGMULTI_CUSER1 IS NOT NULL
AND FGMULTI_CUSER2 IS NOT NULL
AND FGMULTI_CUSER3 IS NOT NULL
AND ROWNUM < 2;

UPDATE IQMS. FGMULTI GAME
CUSER1 = cuser_one,
CUSER2 = cuser_two,
CUSER3 = cuser_three
WHERE ID = P_FID;

END IF;

END;

Published by: user13317821 on March 16, 2011 07:12

Published by: user13317821 on March 16, 2011 07:16

Published by: user13317821 on March 16, 2011 07:19

It makes more sense. This is your problem:

SQL> CREATE TABLE t (lot_no CHAR(10));  -- note the datatype

Table created.

SQL> insert into t values ('2910');

1 row created.

SQL> commit;

Commit complete.

SQL> DECLARE
  2     p_lot VARCHAR2(10) := '2910';  -- note the datatype
  3     l_cnt NUMBER;
  4  BEGIN
  5     SELECT count(*) INTO l_cnt
  6     FROM t
  7     WHERE lot_no = p_lot;
  8     DBMS_OUTPUT.Put_Line('count is: '||l_cnt);
  9  END;
 10  /
count is: 0

SQL> DECLARE
  2     p_lot VARCHAR2(10) := '2910';
  3     l_cnt NUMBER;
  4  BEGIN
  5     SELECT count(*) INTO l_cnt
  6     FROM t
  7     WHERE lot_no = '2910';
  8     DBMS_OUTPUT.Put_Line('count is: '||l_cnt);
  9  END;
 10  /
count is: 1

Oracle stores the right CHAR data types padded spaces to the defined length. When comparing a literal string (such as '2910') Oracle will be also the string literal key. It does not when you compare a variable binding as in your case.

You must do this:

SQL> DECLARE
  2     p_lot CHAR(10) := '2910'; -- note the datatype
  3     l_cnt NUMBER;
  4  BEGIN
  5     SELECT count(*) INTO l_cnt
  6     FROM t
  7     WHERE lot_no = p_lot;
  8     DBMS_OUTPUT.Put_Line('count is: '||l_cnt);
  9  END;
 10  /
count is: 1

Or generally better style

variable table.column%Type;

Better would be to not use the CHAR data type at all, always use VARCHAR2 instead.

John

Tags: Database

Similar Questions

  • Set limits for requests for execution in the Variable Designer


    Hello world

    In Variable Calc Manager Designer, there is a place to enter within the limits of the variables.  I have currently a fast run time set up and I wonder if it is possible to give the user the ability to view all of the hierarchy of a dimension when prompted, but accept only level 0 members.  Right now, if I limit it to upgrade only 0 members, it is confusing to the end user because it is an endless list of members with no order.  So I want to be able to continue to use the hierarchy to navigate to the Member at level 0, but only accept it and run the rule if it is a 0 level.  Thanks for your help!

    Maybe you could be a condition in the calculation to accept only level 0.

    So if the user selects a level no 0 member the business rule will not run finished.

    An example would be:

    IF (@ISLEV ('dimension', 0))

    do something

    on the other

    do nothing

    endif

    I think you can have message appear with a function so that you can inform the user that the input value was not level 0

    Concerning

    Jimmy

  • Dynamically create a file using the variable

    HI, I am facing a problem in creating file on the time of execution using the variable.
    I have a variable file name. In the tab refresh, I wrote a query SELECT TO_CHAR (SYSDATE, 'YYYY, MM, DD') | 'TEST' FOR DOUBLE. I tested the variable and its value is correct.

    I've created an interface allowing to extract the data in the table and store it in the file. I assigned the variable file name in the file.

    Now when I run the interface... the file is created, but the header is created in different file and its name is ambiguous, g (19) and the data are placed in the other file with the name that matches the value of the variable filename...

    It is two ODI creates two files a single header and other data...

    When I run my interface in a package of the file created perfectly... but one i want to use package I want to create a file via the interface only running

    What is the name of the second file? (the file that does not have the name of the variable)

  • Version of 5.0.2.00.07(online à APEX) - error in the execution of a stored procedure through anonymous block

    DECLARE

    the stored procedure varchar2 (25);

    BEGIN

    -DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");

    the stored procedure: =: procname;

    DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    stored procedure.

    END;

    : procname is a variable binding in the apex to switch the running value.

    apex-bind_var.png

    This is the error I get

    ORA-06550: line 7, column 2:

    PLS-00221: "STORED procedure" is not a procedure or is not defined

    ORA-06550: line 7, column 2:

    PL/SQL: Statement ignored

    5the stored procedure: =: procname;

    6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    7. the stored procedure.

    8 END;

    SmtWtL wrote:

    DECLARE

    the stored procedure varchar2 (25);

    BEGIN

    -DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");

    the stored procedure: =: procname;

    DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    stored procedure.

    END;

    : procname is a variable binding in the apex to switch the running value.

    This is the error I get

    ORA-06550: line 7, column 2:

    PLS-00221: "STORED procedure" is not a procedure or is not defined

    ORA-06550: line 7, column 2:

    PL/SQL: Statement ignored

    5. the stored procedure: =: procname;

    6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    7. the stored procedure.

    8 END;

    What you're trying to achieve?

    Bind variables cannot be used for the dynamic execution of stored programs. Dynamic SQL using lexical rather than bind substitution must be used to run when the program name is not known until execution of the programs.

    declare
      sproc varchar2(25);
    begin
      sproc := :procname;
      dbms_output.put_line('procedure:'||sproc);
      execute immediate 'begin ' || sproc || '; end;'; -- DO NOT DO THIS!
    end;
    

    It is a fundamental design flaw and a security disaster. It's stops essential compilation controls is performed and is open to attack by SQL injection and other security vulnerabilities. There is no good reason to do this.

  • ODI 11 g | Passing the value of the variable ODI option procedure

    Hi Experts,

    I need to pass the value of the global variable / project to an option of the procedure and in the application of the procedure to retrieve. Procedure will be implemented in jython.

    How can I pass the value of the variable option procedure ODI & then retrieve it in the jython script?

    Model data source is the flat file based & I want to retrieve the location of the source directory using jython/java (must implement an on file preprocessing step before calling the interface to load). Is there an ODI API to retrieve the location of the source directory?

    Thank you
    Ashish

    The reason OdiGetOption won't work because odigetoption running will search for the name of the variable where like everything using the execution variable will look at the value of the variable.
    In order to manage your situation i belive, we can establish by using the combination of getoption and global variable using the if condition

    You can write code something like that
    If odigetoption == 'dat ':
    ctrlfileExt = #v_CtrlFileExt
    If odigetoption == "txt":
    ctrlfileExt = #v_CtrlFileExtTxt

    This way, when you call the procedure, you can supply the value of the extension and procedure will use the right variable and the value.

    I hope this helps.

  • ODI-1226: Error_log_procedure step fails after 1 attempt. ODI-1232: the execution of the procedure error_log_procedure failed. ODI-1246: the logical schema has not been defined for error_log_procedure.

    I created a procedure running during the mapping fails but I am facing this error

    ODI-1226: Error_log_procedure step fails after 1 attempt.

    ODI-1232: the execution of the procedure error_log_procedure failed.

    ODI-1246: the logical schema has not been defined for error_log_procedure.

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:754)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:730)

    at oracle.odi.runtime.agent.execution.SessionTask.getExecutor(SessionTask.java:239)

    at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:152)

    at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:111)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:864)

    to oracle.odi.runtime.agent.execution.SessionExecutor$ SerialTrain.runTasks (SessionExecutor.java:2024)

    at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:562)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:718)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:611)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)

    at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 1400 (StartSessRequestProcessor.java:74)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:702)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:108)

    to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:471)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Navigate to the ODI object with the name error_log_procedure , which I assume is an ODI procedure. On the target tab (and if this source) make sure that you have specified a logical schema in the appropriate drop-down box

  • Problems of execution of a SQL function with a variable in the WHERE clause

    Hello world!

    I have programmed a function that returns a boolean value based on the result of the SQL. It's the function:

    FUNCTION existe_secuencial (seq_name VARCHAR2) RETURN AS BOOLEAN

    cursor c2 is SELECT FROM all_sequences WHERE upper (sequence_name) = sequence_name' | seq_name | ' ;

    BEGIN

    OPEN c2;

    DBMS_OUTPUT. Put_line (nombre_seq);

    Get c2 INTO kk;

    If c2% NOTFOUND = True THEN

    RETURNS false;

    on the other

    RETURNS true;

    end if;

    END existe_secuencial;

    And I give the floor to the function of a procedure in this way:

    IF existe_secuencial ("SEQ_ARQUETA") = True THEN

    DBMS_OUTPUT. Put_line ('exists');

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("' NOT exists");

    END IF;

    The probrem that this SQL is forced to return results because this sequence exists in the comic book, but is not, return me the FALSE value. What makes me mad is that if I change the second line of the function in this way:

    > > cursor c2 is SELECT FROM all_sequences WHERE upper (sequence_name) sequence_name ="SEQ_ARQUETA";

    It works find and return of sequence existing (real)

    Can someone help me please, I'm quite desperate to find what is the problem with that because I do not understand why if I built the slider with a variable returns no results so that if I do write it works...

    Thanks in advance!

    Itziar

    Frame you your variable in quotes, which makes the string literal ' |. ' seq_name | "rather than the content of the variable.

    I think that something like this would be an improvement.

    function existe_secuencial (seq_name VARCHAR2) return a Boolean value as

    number of exist_check: = 0;

    Start

    Start

    Select 1

    in exist_check

    of all_sequences

    where upper (sequence_name) = upper (seq_name);

    exception

    When no_data_found then

    null;

    end;

    return (exist_check = 1);

    end existe_secuencial;

  • Pass the value of the variable during execution

    Hello

    I have a package with a set of interfaces and three other variables.

    I want to pass the value of the variable at runtime, based on the value passed I want to decide which interface to run then. How can I do this? I got a set variable but I want to asssign the value during execution.

    Any help is greatly appreciated.


    Thank you
    San

    You have many options to achieve this goal.

    1. keep the run settings in the database, extract the Variables in a time of refreshment and use these variables in your Interfaces to get values of execution.

    2. change the value to the variables on the outside. You can declare a variable in a package as a step of the statement, and then use the variable in your interface in a successive step in your package. Then, create a scenario of your package and creating the scenario, it will prompt you to include the variables that you want to include as a startup parameter. Choose the one (s) concerned. Citing this scenario using Java or an OdiStartScen command or by using Webservices ODI externally, you can provide values of the runtime as a result.

    I hope this helps.

    Concerning
    A

    Published by: 922636 on August 29, 2012 23:53

  • Execution plan will change if I use the variable binding instead of the literal value?

    Hi guys,.

    Suppose I have a select "... Of... WHERE ID = 2 and... "if I go to use the variable binding instead of the literal value 2," SELECT... " Of... WHERE ID =: p_id and... ", the execution plan change?
    I test multiple statements, the plan does not change, but I don't know if it would even as well as in some other cases.
    Someone at - it ideas?

    Thank you very much.

    Anneso wrote:
    Hi, sorry for the unclear post, it's 11 GR 2.

    As Sybrand already mentioned, there are a lot of change that came in the implementation of the bind variable in some versions of Oracle db. Since you're on 112, it is still true with the introduction of Adaptive Cursor Sharing . Please have a read on it since the post below written by the development of Oracle optimizer group.
    http://blogs.Oracle.com/optimizer/entry/why_are_there_more_cursors_in_11g_for_my_query_containing_bind_variables_1

    Aman...

  • The execution of a stored procedure from inside the cursor for loop?

    I posted this in the SQL Developer forum, but I tried in SQLPlus and get the same error, so I think it's an encoding issue.
    I have a piece of code that I'm trying to write that will only be executed once. The goal: we have three tables relating to the pieces of information. Each table has a column that stores the number of site that belongs to the part. We want to copy the parts of a site to about 130 sites which don't have any info on parts. The number of site is stored in another table. So I created three stored procedures, one for each of the three tables that we, who take 2 inputs: a source and destination site. Procedure names are: ptfile_copy_fac, ptxref_copy_fac and ptvndrs_copy_fac.

    The problem I have is that I can run the procedures in a separate worksheet in SQL Developer, but when they are integrated in this cursor for loop, I get the following message from SQL Developer:

    ORA-06550: line 23, column 11:
    PLS-00103: encountered the symbol "PTFILE_COPY_FAC" during the expected in the following way:
    := . (@ %; immediate)
    The symbol ': = ' was replaced by 'PTFILE_COPY_FAC' continue.

    He repeated this for each of the three methods. I have attached the code I am trying to run below. He expects an assignment operator, but I have no idea why.

    If there is a better way to do this, by all means let me know. I'm a SQL Server guy, I'm not sure how to do what I do using PL\SQL.

    / * Declares the variables source_fac and dest_fac.
    The source_fac is the installation that we copy parts.
    The dest_fac is the installation we copy parts to.* /

    DECLARE
    source_fac facility.facility_num%type;
    INSTALLATION OF DEST_FAC. TYPE % FACILITY_NUM;

    / * Declare cursor to use loop for.
    Slider load number installation and the status of the installation.
    Is not installation of 1 or 2, since these will be
    the main source of facilities.*.

    CURSOR fac_cursor
    IS
    SELECT
    facility_num,
    div_state
    Of
    installation
    WHERE
    facility_num NOT IN (1,2);
    BEGIN
    FOR fac_row IN fac_cursor
    LOOP

    / * Test for the State of the installation. If a Canadian State, the source_fac value 2.
    Otherwise, the value source_fac 1.* installation.

    IF fac_row.div_state IN ("AB", "BC", "Mo", "NB", "NL", "NT", "NS", "NAKED", "WE", "PE",
    "QC", "SK", "YT")
    THEN
    source_fac: = 2;
    ON THE OTHER
    source_fac: = 1;
    END IF;

    / * Sets the installation of destination to the facility_num from the cursor * /.

    DEST_FAC: = FAC_ROW. FACILITY_NUM;

    / * Execute the three procedures, past of the source and dest AEC variable * /.

    run ptfile_copy_fac (source_fac, dest_fac);
    run ptxref_copy_fac (source_fac, dest_fac);
    run ptvndrs_copy_fac (source_fac, dest_fac);

    END LOOP;

    END;

    Published by: SunDevilKid on March 3, 2010 15:31
    Update the comments you make more sense of the code.

    EXECUTE is a SQLPlus command, change your code to

    dest_fac := fac_row.facility_num;
    ptfile_copy_fac(source_fac, dest_fac);
    ptxref_copy_fac(source_fac, dest_fac);
    ptvndrs_copy_fac(source_fac, dest_fac);
    END LOOP;
    

    Max
    http://oracleitalia.WordPress.com

  • How to use the variable instead of the table name in the select statement of procedure

    I have a procedure with a select statement with dynamic from clause. How can I use instead of the name of the table variable.

    create or replace procedure scc_chemical_analysis
    is
    v_table_name varchar2 (100);
    Start

    declare
    cursor c1 is select * from v_table_name; -This is the variable name. How can I use it in the select statement.
    .
    .
    .
    .



    end;

    Hello

    something like that.

      1  declare
      2     vSQLString      VARCHAR2(32000);
      3  pTableName varchar2(1000):='EMP';
      4  BEGIN
      5     vSQLSTRING :=
      6  'SELECT ''x'' FROM ' || DBMS_ASSERT.sql_object_name(pTableName) || ' WHERE rownum<=1 ';
      7     EXECUTE IMMEDIATE vSQLSTRING;
      8* END;
    SQL> /
    
    PL/SQL procedure successfully completed.
    
  • Access the variable in different class

    Hey guys,.

    So I make a program that generates circles where you click, and I want to apply some physics. I was thinking about creating a new class that contains all of the physical code and then apply to the circles that are created, which is the way to do it?

    I can't use the name of the variable of the circle in the physics class. And some stuff on the web that is said to make the variable public, and static, but I create the variable inside of a function, and it wont let me make public or static it. Even if I put it in the class, I get the same error (access from the circle of property not defined). Here is the code:

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

    package {}

    import flash.display.Shape;

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    import flash.media.Sound;

    import flash.media.SoundChannel;

    Import fl.transitions.Tween;

    Fl.transitions.easing import. *;

    Import fl.transitions.TweenEvent;

    import flash.utils.Timer;

    import flash.events.TimerEvent;

    SerializableAttribute public class Main extends MovieClip

    {

    var pop: PopSound;

    var soundChannel:SoundChannel;

    var circleReady:Boolean = new Boolean;

    var coolDown:Timer;

    public void Main()

    {

    stage.addEventListener (MouseEvent.MOUSE_DOWN, mouse click);

    pop = new PopSound();

    soundChannel = new SoundChannel();

    circleReady = true;

    cooldown = new Timer (500, 1);

    }

    function mouseClick(e:MouseEvent):void

    {

    If (circleReady is true)

    {

    var theX:Number = mouseX;

    var they: number = mouseY;

    var circle: Shape = new Shape();

    circle.graphics.beginFill ((Math.random () * 0xFFFFFF), 1.0);

    circle.graphics.drawCircle (0, 0, ((Math.round (Math.random () * 40)) + 20));

    circle.graphics.endFill ();

    Circle.x = definition x;

    Circle.y = they.

    stage.addChild (circle);

    var xTween:Tween = new Tween (circle, "scaleX", Bounce.easeOut, 0, 1, 0.5, true);

    var yTween:Tween = new Tween (circle, "scaleY", Bounce.easeOut, 0, 1, 0.5, true);

    soundChannel = pop.play ();

    circleReady = false;

    coolDown.addEventListener (TimerEvent.TIMER_COMPLETE, timeDone);

    coolDown.start ();

    }

    function timeDone (e:TimerEvent): void

    {

    circleReady = true;

    }

    {

    }

    }

    }

    }

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

    Any help would be great, thanks

    How can ensure me that the compiler finds Collision.as?

    According to the file format that you are using:

    1. . FLA: Collision.as must live in the same folder as the FLA

    2..XFL: Collision.as has to live at a higher level the. XFL file (on the same level as the folder with the same PREFIX as your xfl)

  • go to the next iteration of loop for and continue execution of the previous iteration

    Hello everyone,

    I want to run a loop with an offset to each iteration. I explain: I want to run a task multiple times (for loop), but with a variable delay in each iteration.

    Thus, if we put t = 0 before you run the loop and I use 3 iterations. I put a writ of execution to the first ieration after 3 sec then skip to the next iteration of course without waiting the end of the previous iteration and run the current iteration after 1.5 s and go to the third ieration (once again without waiting for the latest iteration).

    I conclude: this is a simultaneous execution of a for loop (10 to 50) from different eras (variable time between t = 0 and each running of each task.

    The problem I found in the loop is the fact that I have to wait the end of the time delay in each iteration bfore going on to the next.

    Best regards

    In all languages, a loop iteration FOR happens AFTER previous.  However, go with the parallelized FOR loop can happen to you.

  • The execution of the interface failed

    Hello guys,.

    When I try to run the interface, I get error below.

    ODI-1228: failed OV_INT_STG_FI_EVENT_F_TI_CSV (integration) task on the target of ORACLE OVAPPS connection.
    Caused by: java.sql.SQLSyntaxErrorException: ORA-00923: KEYWORD not found where expected

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1115)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3954)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1539)
    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)




    My Code is

    INSERT
    IN OVETL. ETL_AUDIT_STATS
    *(*
    SCEN_NAME,
    BTCH_NAME,
    START_DATE,
    ETL_SESS_ID,
    ETL_SESS_STS
    *)*
    SELECT "OV_INT_STG_FI_EVENT_F_TI_CSV."
    ' *' #COPY_OF_FI_1.V_BTCH_NAME ', *.
    TO_date (SUBSTR ("11:22:22.0 2013-05-28', 1, 19),"YYYY-MM-DD HH24:MI:SS"),
    * 8002 *.
    * "START."
    OF the double


    Please help me.


    Thank you

    Hi Vooda,

    some named him:
    1 - the code is used in an interface
    2. you don't need a block anonymous for a procedure, just put sql and select oracle

    Back to the thread, the question is the variable "#COPY_OF_FI_1.V_BTCH_NAME." Are you sure that you do not use ' #COPY_OF_FI_1.V_B * has * TCH_NAME instead? In your mode to open your session, history of the variable, V_BTCH_NAME,. Any value on this tab? Also check that this variable is of type "last value".

  • NPL of multiple execution for the awr sql_id

    Hi Experts,

    NPL of multiple execution for the AWR sql_id,

    I followed questions

    1. What plan using opimizer tcurrently?
    2. make sure optimizer to choose good plans


    SQL > select * from table (dbms_xplan.display_awr ('fb0p0xv370vmb'));

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID fb0p0xv370vmb
    --------------------

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Hash value of plan: 417907468

    ---------------------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |
    ---------------------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 63353 (100) |
    | 1. UPDATE |
    | 2. SORT ORDER BY | 17133. 2978K | 3136K | 63353 (1) | 00:14:47 |
    | 3. HASH JOIN RIGHT SEMI | 17133. 2978K | 62933 (1) | 00:14:42 |
    | 4. COLLECTION ITERATOR PICKLER FETCH | |
    | 5. HASH JOIN RIGHT SEMI | 68530 | 11 M | 62897 (1) | 00:14:41 |

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 6. VIEW | VW_NSO_1 | 5000 | 35000 | 33087 (1) | 00:07:44 |
    | 7. COUNTY STOPKEY |
    | 8. VIEW | 127K | 868K | 33087 (1) | 00:07:44 |
    | 9. GROUP SORT BY STOPKEY | 127K | 2233K | 46 M | 33087 (1) | 00:07:44 |
    | 10. TABLE ACCESS FULL | ASYNCH_REQUEST | 1741K | 29 M | 29795 (1) | 00:06:58 |
    | 11. TABLE ACCESS FULL | ASYNCH_REQUEST | 1741K | 280 M | 29801 (1) | 00:06:58 |
    ---------------------------------------------------------------------------------------------------------------

    SQL_ID fb0p0xv370vmb
    --------------------
    SELECT ASYNCH_REQUEST_ID, REQUEST_STATUS, REQUEST_TYPE, REQUEST_DATA, PRIORITY, SUBMIT_BY, SUBMIT_DATE.

    Hash value of plan: 2912273206

    --------------------------------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 45078 (100) |
    | 1. UPDATE |
    | 2. SORT ORDER BY | 1323. 257K | 45078 (1) | 00:10:32 |
    | 3. TABLE ACCESS BY INDEX ROWID | ASYNCH_REQUEST | 1. 190. 3 (0) | 00:00:01 |
    | 4. NESTED LOOPS | 1323. 257K | 45077 (1) | 00:10:32 |
    | 5. THE CARTESIAN MERGE JOIN. 5000 | 45000 | 30069 (1) | 00:07:01 |
    | 6. UNIQUE FATE |
    | 7. COLLECTION ITERATOR PICKLER FETCH | |
    | 8. KIND OF BUFFER. 5000 | 35000 | 30034 (1) | 00:07:01 |
    | 9. VIEW | VW_NSO_1 | 5000 | 35000 | 30033 (1) | 00:07:01 |

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 10. UNIQUE FATE | 5000 | 35000 |
    | 11. COUNTY STOPKEY |
    | 12. VIEW | 81330 | 555K | 30033 (1) | 00:07:01 |
    | 13. GROUP SORT BY STOPKEY | 81330 | 1 429 K | 2384K | 30033 (1) | 00:07:01 |
    | 14. TABLE ACCESS FULL | ASYNCH_REQUEST | 86092 | 1513K | 29731 (1) | 00:06:57 |
    | 15. INDEX RANGE SCAN | ASYNCH_REQUEST_SUB_IDX | 1 | | | 1 (0) | 00:00:01 |
    --------------------------------------------------------------------------------------------------------------------------

    Hash value of plan: 3618200564

    --------------------------------------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 59630 (100) |
    | 1. UPDATE |
    | 2. SORT ORDER BY | 4474 | 777K | 59630 (1) | 00:13:55 |
    | 3. HASH JOIN RIGHT SEMI | 4474 | 777K | 59629 (1) | 00:13:55 |
    | 4. VIEW | VW_NSO_1 | 5000 | 35000 | 30450 (1) | 00:07:07 |
    | 5. COUNTY STOPKEY |
    | 6. VIEW | 79526 | 543K | 30450 (1) | 00:07:07 |
    | 7. GROUP SORT BY STOPKEY | 79526 | 1397K | 7824K | 30450 (1) | 00:07:07 |
    | 8. TABLE ACCESS FULL | ASYNCH_REQUEST | 284K | 5003K | 29804 (1) | 00:06:58 |
    | 9. TABLE ACCESS BY INDEX ROWID | ASYNCH_REQUEST | 71156 | 11 M | 29141 (1) | 00:06:48 |

    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 10. NESTED LOOPS | 71156 | 11 M | 29177 (1) | 00:06:49 |
    | 11. UNIQUE FATE |
    | 12. COLLECTION ITERATOR PICKLER FETCH | |
    | 13. INDEX RANGE SCAN | ASYNCH_REQUEST_EFFECTIVE_IDX | 327K | | 392 (1) | 00:00:06 |
    --------------------------------------------------------------------------------------------------------------------------------

    Thank you
    -Raj

    Published by: tt0008 on August 22, 2012 20:34

    Hello

    (1) you can see what plan has been used lately by running this query:

    select begin_interval_time, plan_hash_value
    from dba_hist_sqlstat st,
            dba_hist_snapshot sn
    where st.snap_id = sn.snap_id
    and sql_id = 'fb0p0xv370vmb'
    order by begin_interval_time desc;
    

    However, there is no guarantee that the next time you run this query, the latest plan will be chosen.
    Periodically, the plan is regenerated (for example when new statistics are collected, is the structure of a table referenced in)
    the query is changed etc.), and you can get 4 plans, or even a new function of many factors
    (statistics, bind variable values, the optimizer, NLS etc settings settings.)

    (2) this question is too large for the answer to fit into a thread, there are books written on the subject. The short answer is:
    If you know which of the 4 plans is right for you, then you can use a stored outline to lock in (it seems that you are not on 11g so SQL Profiler are not an option for you).
    Or you can try to find out why the optimizer generates different plans and address the underlying issue (the most common reason is to bind peeking - but to say
    course, we need to know more, starting with the text of your query).

    Best regards
    Nikolai

Maybe you are looking for