Encountering transaction statement from within a PL/SQL block

Hi All,
i would like to know what will be the transaction status if we use an commit or a rollback statement inside a PL/SQL procedure called from within an PL/SQL package.
For example
BEGIN
select statement
insert statement 1
.... call to <xyz> procedure
end;
xyz procedure
insert statement 2
commit/rollback
end of procedure
will the insert statement 1 be commited/rollbacked when the session encounters the transaction statement inside the procedure.

Welcome to the forum!
Unless the procedure xyz is an autonomous transaction, then yes Insert statement 1 will be committed.

Similar Messages

  • Not able to display javascript alert message from within a pl/sql block

    Hello,
    Can anyone please help me out with this issue. I wanted to display an javascript alert message from within a pl/sql block for an update button. Below is sample code which i am using. P1_ITEM is my hidden item on the report.
    begin
    if :P1_ITEM IS NOT NULL then
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Please complete the item which is already assigned to you!'');');
    HTP.p ('</script>');
    end if;
    end;
    and I have made this code to be executed conditionally when request = Expression1
    Expression1: SUBMIT
    The thing is I am not able to display an alert message when the update button is clicked.
    Can anyone please help me with this one.
    Thanks,
    Orton

    varad but I also have an update statement within that block for the update button something like this i want to achieve.
    begin
    if :P1_ITEM IS NULL THEN
    update sample_tbl
    set col1 =:APP_USER,
    col2 = 'Y'
    where pk_col = ---;
    commit;
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Successfully assigned an item!'');');
    HTP.p ('</script>');
    end if;
    if :P1_ITEM IS NOT NULL then
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Please complete the item which is already assigned to you!'');');
    HTP.p ('</script>');
    end if;
    end;
    thanks,
    Orton

  • Exec SQL statement from BW to MS SQL

    Hi Experts,
    I need to execute sql statement from BW on MS SQL Server.
    I want to do it in process chain. There is a so called ABAP Program Component.
    How to implement such a program or function module that will execute on MS SQL Server an sql statement such as for instance:
    "Create view SOME_VIEW as select * from XTABLE".
    I have already configured database connection using DBCO transaction.
    Waiting for response.
    Krzysztof

    Thanks, but that is not what I was asking for.
    I just need to send some SQL statement from BW to MS SQL Server using ABAP program (exec sql or something like this).
    Could you provide me a pattern of such an ABAP program?
    The sql statement is not importent here, I have already extracted data from MS SQL to BW, I have configured dataflow, process chains and so on.
    No I need to determine DELTA on MS SQL Server. I've got some ideas but I need to know how to send SQL statement from BW to MS SQL Server using ABAP program.
    Please any help will be appreciated

  • Insert Stmt behaving differently within a PL/SQL block than independently

    I have an INSERT INTO statement that is behaving different within a PL/SQL block than it does if ran as an independent SQL query. When executed within a PL/SQL block the INSERT statement does insert rows, but only less than 50% of the rows returned by the SELECT statement used by the INSERT. There are no constraints and the only check on the destination table is a NOT NULL for supplier_id column.
    BEGIN
        INSERT INTO suppliers (supplier_id, supplier_name)
        SELECT account_no, name FROM customers WHERE city = 'Newark';
    END;Can anyone help me with this?
    Thanks

    Thought this sounded familiar:
    INSERT INTO statement that is behaving different within a PL/SQL block

  • Need to refresh materialized view from procedure and pl/sql block

    Hi,
    I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
    MV name:MV_DGN_TEST_SESSION
    Thanks,
    Rajasekhar

    dbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
    Mahesh Kaila
    Edited by: user4211491 on Dec 1, 2009 10:41 PM

  • Changing states from within a component

    Let's say that I have a TileList that is rendering data in a
    VBox. Eventually the TileList fills up and starts scrolling. I want
    to change states when clicking on item in the TileList.
    I don't want to place the click-attribute in the TileList,
    because it will change states when I am scrolling the list without
    actually selecting anything.
    I want to say click="currentState='state2'" inside the VBox,
    but that does not work because state2 is at the root level, and I
    don't know how to get to the root-level (in lack of a better word)
    from withing the component.
    This is not the proper syntax, so misunderstand me the right
    way here... Is there an equivallence to
    click="currentState='_root.state2'" in mxml?
    Thanks for any suggestions or best practices. I want the easy
    way out.
    This is the general structure...
    <mx:Application>
    <mx:states>
    <mx:State id="state1"/>
    <mx:State id="state2"/>
    <mx:State id="state3"/>
    </mx:states>
    <mx:TileList dataprovider="{...}">
    <mx:itemRenderer>
    <mx:component>
    <mx:VBox id="ClickThisBoxToChangeStates">
    <mx:Image/>
    <mx:Label/>
    </mx:Vbox>
    </mx:component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

    Your assumption is right.
    It doesn't work because there is no state2-state defined
    within the mx:component.
    In the documentation about changing states it says that I can
    go from application level and change states within a component;
    like this: click="currentState='mycomponent.anotherstate'" but not
    how I can change a state at application level from within a state.
    When I try, it says (at runtime) that the state is not defined.
    So I don't know why <mx:VBox
    click="currentState='state2'"/> doesn't work.
    I apprechiate your expertese a lot.

  • Maximize window state from within portlet faces hyperlink?

    Does anyone know how to implement/force window state from a hyperlink? I want to maximize the portlet window when any hyperlink is clicked from within the default view mode. The javax portlet api tags allow you to set this attribute like <portlet:actionURL windowState="maximized"/>. Is there a similar way to do this from within Creator's use of jsf? Or, am I going to have to do this within the class files? Thanks much

    Yes, does anyone know how to maximize a portlet? Thanks.

  • Update Statement(with Case) in PL/SQL Block

    Can we use Oracle case syntax (In a Update SQL)in a PL/SQL Block .
    UPDATE table_name a
    SET a.colum1 =
    case when a.col2 IN (SELECT col1
    FROM table_name1 b )
    then 'Y'
    else 'N'
    end
    It throws me an Error of code PLS-00103(This error message is from the parser. It found a token (language element) that is inappropriate in this context.)
    Is there any alternative...
    Thanx in Advance
    null

    Alas, PL/SQL has own SQL parser, and this parser dosn't know about CASE expressions (at least, it's true up to Oracle 8.1.7).
    Try to use DECODE instead, something like
    UPDATE table_name a
    SET a.colum1 =
    SELECT decode(count(*),0,'N','Y)
    FROM table_name1 b
    WHERE b.col1=a.colum1

  • Can't create a sequence within a pl/sql block with execute immediate.

    Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
    Thanks,
    Mark

    In a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
    There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
    Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
    You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
    And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
    Justin

  • Calling shell scripts from within Oracle PL/SQL codes

    Hello,
    We are migrating from informix to Oracle. In our Informix Stored Procedure we
    were able to call Unix Shell Script by executing a 'SYSTEM' command, such as:
    CREATE PROCEDURE magazine(flag1, flag2)
    SYSTEM '/pics2/informix/mag.sh' || flag1 || flag2;
    END PROCEDURE;
    How can I write this in PL/SQL? Is there a simillar command for 'SYSTEM' in PL/SQL?
    Thanks

    Mike,
    Wrong forum, for this question, suggest you ask it in the PL/SQL forum.
    Jim Stern

  • External Web services call from within Oracle Pl/SQL

    Hi there,
    can anyone guide me whether there is any option to create web services call from Oracle Stored procedure ? ( External web services are available using SOAP)
    Thanks in advance.
    Regards,
    Jatin

    http://bit.ly/Uiaies

  • Using Connect within a PL/SQL block

    Hi,
    I have a package, inside that i have many procedures & functions, in one of my procedure, i want to use [connect username/password] within a procedure.
    This procedure is called by our client program (in VC++), they will just call the procedure name with parameters, but the procedure should internally connect to one more user & perform some dba related operations, all these things are done in the procedure only, clint will not be aware of the internal operations.
    I tried to give connect within the procedure,
    it gives an error Invalid SQL stmt while compiling the package. Is there any way to do this.
    Pls. reply me back.
    Bye
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by pratibha:
    Hi,
    I have a package, inside that i have many procedures & functions, in one of my procedure, i want to use [connect username/password] within a procedure.
    This procedure is called by our client program (in VC++), they will just call the procedure name with parameters, but the procedure should internally connect to one more user & perform some dba related operations, all these things are done in the procedure only, clint will not be aware of the internal operations.
    I tried to give connect within the procedure,
    it gives an error Invalid SQL stmt while compiling the package. Is there any way to do this.
    Pls. reply me back.
    Bye
    <HR></BLOCKQUOTE>
    null

  • Executing OS command from within PL/SQL...

    Hi
    I would like to know if you can issue operating system command
    from within a PL/SQL block on Oracle Database(not developer
    2k) .Is there any built in package for the same ? Like a similar
    command is available in forms i.e HOST .
    Can anyone help please ?
    Thank You
    Cheers
    Raghavendra
    null

    The only documentation I have seen uses dbms_pipe which
    communicates with a host 3gl program, usually C, which in turn
    issues a call to the c function system(). You could also mimic
    these same actions without using dbms_pipe by using a extproc
    program linked to the database if you are running db version 8.0
    or above. See the pl/sql procedure manual for dbms_pipe examples.
    Raghavendra (guest) wrote:
    : Hi
    : I would like to know if you can issue operating system command
    : from within a PL/SQL block on Oracle Database(not developer
    : 2k) .Is there any built in package for the same ? Like a
    similar
    : command is available in forms i.e HOST .
    : Can anyone help please ?
    : Thank You
    : Cheers
    : Raghavendra
    null

  • Running multiple SQL statements from DBMS_SCHEDULER

    DB Version : 10.2.0.4
    After refering the following document, i am trying to create a job which will run 2 SQLs ; An INSERT and an UPDATE as shown below.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/jobtosched.htm#i1018602
    create table xyz (empid  number,empname varchar2(35),cre_dt date);
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
       job_name          =>  'job32',
       job_type          =>  'PLSQL_BLOCK',
       job_action        =>  'INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE),'UPDATE MANU.XYZ SET EMPID = 33';
       start_date        =>  SYSDATE,
       repeat_interval   =>  'FREQ = DAILY; INTERVAL = 1');
    END;
    /But i am getting errors like below, when i try to create the above job.
    ORA-01756: quoted string not properly terminated
    PLS-00103: Encountered the symbol ";" when expecting one of the following:

    You need to enclose those statements in an anonymous PL/SQL block
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
       job_name          =>  'job32',
       job_type          =>  'PLSQL_BLOCK',
       job_action        =>  'BEGIN INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE); UPDATE MANU.XYZ SET EMPID = 33; END;'
       start_date        =>  SYSDATE,
       repeat_interval   =>  'FREQ = DAILY; INTERVAL = 1');
    END;
    /

  • Pl/sql block reading reading table data from single point in time

    I am trying to figure out whether several cursors within a PL/SQL block are executed from within a Single Point In Time, and thus do not see any updates to tables made by other processes or procedures running at the same time.
    The reason I am asking is since I have a block of code making some data extraction, with some initial Sanity Checks before the code executes. However, if some other procedure would be modifying the data in between, then the Sanity Check is invalid. So I am basically trying to figure out if there is some read consistency within a PL/SQL, preventing updates from other processes to be seen.
    Anyone having an idea?.
    BR,
    Cenk

    "Transaction-Level Read Consistency
    Oracle also offers the option of enforcing transaction-level read consistency. When a transaction runs in serializable mode, all data accesses reflect the state of the database as of the time the transaction began. *This means that the data seen by all queries within the same transaction is consistent with respect to a single point in time, except that queries made by a serializable transaction do see changes made by the transaction itself*. Transaction-level read consistency produces repeatable reads and does not expose a query to phantoms."
    http://www.oracle.com/pls/db102/search?remark=quick_search&word=read+consistency&tab_id=&format=ranked

Maybe you are looking for