If sqlplus session statement

Hi all

I have to get the result of a statement and continue.

This runs a sqlplus session.

Oracle 11g

declare v_dname varchar (20);
Start
Select djob.get_dbname in the sys.dual v_dname;
end;

If (v_dname = "PRD") then

run IMMEDIATELY 'truncate table MY_DAT_TBL;

-all the summary records
INSERT in MY_DAT_TB v
SELECT *.
OF ROLL_SALES_DATA;

Commit;

end if;

Thank you
Jac

Put all your logic/code in a pl/sql block.

SQL Plus is not a programming language.

Tags: Database

Similar Questions

  • commit and rollback in sqlplus session

    Hi all

    I noticed that whenever I got out after a statement keep telling (insert or update or delete) transaction, sqlplus is committed by its on.
    Why its kind? is this a configuration in oracle?
    How we control this behavior?


    For example:

    $ sqlplus scott/tiger@orcl
    SQL > sho autocommit
    autocommit OFF

    SQL > select * from foo;
    A AND B
    ---------- -------
    100 200
    200 300

    SQL > insert into foo values (300 200);
    1 line of creation.
    SQL > "exit";

    $ sqlplus scott/tiger@orcl
    SQL > select * from x;
    A AND B
    ---------- -------
    100 200
    200 300
    300 200

    From the example above:
    auto-commit is disabled. But always when the session ends, its is committed. Please explain.


    DB: 10 gr 2

    Thanks in advance.

    Is it possible to control the behavior of automatic validation of sqlplus session shortly after release?

    SQL * more

    output + abandonment commits all changes by default, Oracle logs, waiting ends sqlplus and returns control to the operating system. If we wanted to leave SQL more without committing, we should have a restore then output or simply the cancellation of the outputcan be issued.

    OUTPUT
    ----
    Valid or rolls back all the changes pending, Oracle logs.
    terminates SQL * more and returns control to the operating system.
    With iSQL * Plus, commits or cancels all pending changes, stops
    transformation of the current iSQL * more focus script and returns to the
    Workspace. There is no way to access the return code in iSQL * more.
    With iSQL * Plus click the disconnect button to disconnect from the Oracle database.

    OUTPUT SUCCESS
    ENGAGE

    Test-> 'restore output '.

    SQL > create table a nologging in select * from object;

    Table created.

    SQL > select count (*) a;

    COUNT (*)
    ----------
    47945

    SQL > delete from a where rownum clause<>

    10000 deleted rows.

    SQL > "exit";

    $ sqlplus user/pass

    SQL > select count (*) a;

    COUNT (*)
    ----------
    37945

    SQL > delete a;

    37945 deleted rows.

    SQL > exit rollback;

    $ sqlplus user/pass

    SQL > select count (*) a;

    COUNT (*)
    ----------
    37945

    Good luck ;)

  • Session state protection violation

    I created the sample application to the free workspace

    https://Apex.Oracle.com/pls/Apex/f?p=4550:8:0

    Name of workspace: WMS_USER

    Username: [email protected]

    Password: password! 23

    Request 40363 - shipping Office
    : - > Run: click the report item

    When I select the number of the item 50004257 and click on the button new 1 then show the error like session
    violation of protection State

    Can you please help

    This link is not a job for me.

    2942415 wrote:

    I created the sample application to the free workspace

    https://Apex.Oracle.com/pls/Apex/f?p=4550:8:0

    Name of the workspace: WMS_USER

    Username: [email protected]

    Password: password! 23

    Request 40363 - shipping Office
    :-> Run it: click the report item

    When I select item number 50004257 and click on the button new 1 then show the error like session
    violation of protection State

    Can you please help

    This link is not a job for me.

    Check your work application.

    p3_item_desc--> edit-->--> No. session state

  • Get the session state of the order of the day in javascript

    Is there anyway to get the value of an element of demand through jS?

    [I have an app that loads a different source into an iframe depending on which page the user is.]  I can load this value in session state for a part of the application (or a point probably page) but for the redirect which is made in java script I don't know how to get the value of session.  [I do not have it as the value of the client side.]

    Thanks guys, but I think that it would give me only the value in the DOm not in session state.  I had to make a page zero point and dynamic action that populated the in the DOM, and then I could use JS ($v) to get the variables.

    I couldn't find a way to get session state directly.

  • Apex 5.0 "session state protection violation" during the change of display only value point in dynamic action.

    The following feature gives us a message "session state protection violation", after we migrated our application from Apex 4.02 to 5.0.

    For example, in apex.oracle.com: https://apex.oracle.com/pls/apex/f?p=50676:1:

    Whenever the value of the input field changes, the URL to test changes. This is done in a dynamic action of 'change' on the version field. The action of the set value changes the value of URL to test.

    When the page is sent to the error message is displayed.

    1. Why do we get this message in Apex 5.0 and not in 4.0.2?

    2. What is the way to do this in the Apex 5.0?

    Thank you

    René

    Just try save session state - no.

  • Session state protection violation: this can be caused by manually editing the protected page P67_C point. If you don't know what caused this error.

    Hi friends,

    I create three field A textfield,textfield B,C textfield and apply the formula with dynamic action.

    C = A + B.

    Now, I want to protect user could not be total change at point C, so I change it is property of the text field to display only and change in

    Settings-> save the Session State-> Yes

    After all changes when I ran page and provide the registry then it shows me error below.

    Session state protection violation: this can be caused by manually editing the protected page P67_C point. If you don't know what caused this error, contact the administrator of the application for assistance.


    How to disable the total at point C when I use the dynamic action to calculate the Total of A + B.

    Thank you.




    Hi Maxence,

    1. in the case of a display one element

    Change your point of P67_C and change the State of Session Save-> No.

    2. in the case of a text field

    Change your point of P67_C and make it read-only

    go to the attributes of the HTML Form element-> readonly = "readonly".

    Hope this helps you,

    Kind regards

    Jitendra

  • session state variable, concept and work around

    I use the variable session state and tried under the code element. But so far, I've had it is that when a variable assigned a value in plsql block, its scope has ended so only.

    And in the next step using the simple sql variable within the same session, we had manifest error.

    Is there a work around using too simple sql variable.

    SQL> CREATE OR REPLACE PACKAGE MYPACKAGE
      2  as
      3  mysess_var number;
      4  end;
      5  /
    
    
    Package created.
    
    
    SQL> create table tmp_sess as select 1 sess_id from dual;
    
    
    Table created.
    
    
    SQL>
    SQL> declare
      2  begin
      3  MYPACKAGE.mysess_var := 1;--Assiging value
      4  insert into tmp_sess values (MYPACKAGE.mysess_var);
      5  commit;
      6  end;
      7  /
    
    
    PL/SQL procedure successfully completed.
    
    
    SQL> --I also want this to be achive for plain sql syntax,  is it possible
    SQL> insert into tmp_sess values (MYPACKAGE.mysess_var);
    insert into tmp_sess values (MYPACKAGE.mysess_var)
                                 *
    ERROR at line 1:
    ORA-06553: PLS-221: 'MYSESS_VAR' is not a procedure or is undefined
    

    You cannot access variable defined in a package of SQL. Good way would be to define the getter and setter methods.

    SQL> create or replace package mypackage
      2  as
      3    mysess_var number;
      4    procedure set_value (pvalue in number);
      5    function get_value return number;
      6  end;
      7  /
    
    Package created.
    
    SQL> create or replace package body mypackage
      2  as
      3    procedure set_value (pvalue in number)
      4    is
      5    begin
      6      mysess_var := pvalue;
      7    end;
      8
      9    function get_value return number
     10    is
     11    begin
     12      return mysess_var;
     13    end;
     14  end;
     15  /
    
    Package body created.
    
    SQL> exec mypackage.set_value(1)
    
    PL/SQL procedure successfully completed.
    
    SQL> select mypackage.get_value
      2    from dual;
    
     GET_VALUE
    ----------
             1
    
  • Session state and checkboxes

    Hi guys,.

    I'm a little hard with the checkboxes in the APEX 4.2

    I am trying to add 2 boxes in my application to filter the data

    The problem is how then to value by default when the user opens the page, some data are displayed

    If I use the 'Default' section in the details of the box (setting may 1 as default), when I open the web page, the checkbox is marked, but in the session state is not defined so no data will appear. If I submit the new page then Yes, the data is displayed

    I could use a calculation that defined the box = 1 if it is not set when the page loads, but it would not work as the calculation would give it 1 time and again when the user the box remove the flag

    Anyone know how I could apply this?

    Thank you very much

    Hello

    so I found a solution according to the following:

    -create box 2 or more

    -create a hidden text field

    -create a header after calculation that has always defined the hidden field = 1

    -create one before the calculation of header for each box the value = 1 box only if the value of the hidden text field is null

  • How can I get a session state value in my apex or DML text field

    I put a session state in my procedure, in my text field in my I want to get the value of the form region. I try in my text field of the form in the default region, I try

    BEGIN

    APEX_UTIL.GET_SESSION_STATE('USER_SECURITY_PIN');

    END;

    but this does not seem to get the PIN of the session

    How can I do this please

    dave_414 wrote:

    I put a session state in my procedure, in my text field in my I want to get the value of the form region. I try in my text field of the form in the default region, I try

    BEGIN

    APEX_UTIL.GET_SESSION_STATE('USER_SECURITY_PIN');

    END;

    but this does not seem to get the PIN of the session

    How can I do this please

    Depends on the Type of default property item.

    Use a static text with Substitutions of State of Session with a string substitution of static text:

    &USER_SECURITY_PIN.

    or the body of the PL/SQL function (for example):

    return apex_util.get_session_state('USER_SECURITY_PIN');

    or Expression of PL/SQL with a bind variable reference:

    :user_security_pin

  • Session state protection error

    Hello

    I get an error on the browser Internet Explorer (doesn't happen in chrome), which States "Session State protection violation: this can be caused by manually editing the protected page P11_NEW_FLAG point." If you don't know what caused this error, contact the administrator of the application for assistance. Contact your administrator for the application. "


    I don't know why this error because the element P11_NEW_FLAG is NOT protected at all. Here's the security properties are attributed to him:



    Capture.PNG

    It has a readonly condition associated with him making it readonly based on some logic PL SQL.

    I don't know where to start debugging? What can be the root cause?

    Thank you

    Sunil Bhatia

    Hi Sunil Bhatia,

    Sunil Bhatia wrote:

    Hi mohamed,.

    No, its not hidden item, it's a FLAG (Checkbox) I display on the front end. There are readonly. I debugged and error occurring only when the box is read-only. It automatically creates checksum argument.

    Other settings to watch?

    Thank you

    Sunil Bhatia

    You use the condition parameters of article readonly?

    CheckBox and select items does not in HTML readonly property. ReadOnly checkbox in the case of Oracle APEX is setting the disabled property. Therefore, on presentation of the page it is originally the error of session state protection.

    An easy way to do this is to write a dynamic action (run Javascript) to disable the checkbox if necessary:

    $("#P11_NEW_FLAG").attr("disabled",true);
    

    But write a front page submit dynamic action (run Javascript) to activate elements disabled on the page, so that the layout of the page works fine:

    $("#P11_NEW_FLAG").removeAttr("disabled");
    

    Reference: Apex tips and tricks - an easy way to make read-only items

    I hope this helps!

    Kind regards

    Kiran

  • Apex DatePicker setting session state problem.

    Hi all

    Workspace: hanamike

    User name: test

    Password: test

    With the help of dynamic action, run PL/SQL, to set the session state.

    Using Firefox console showing too many recursion error but session state is defined so slow.

    But when the use of Ipad screen will freeze when the session state setting.

    Capture.PNG

    Already had the application properties, security, Mode of escape from HTML to base but still display the date value as a unicode type (c, c ++).

    Please advice.

    Thanks in advance.

    Zack

    You have set something on the change of P1_DATE1 to change the same domain, and "Remove Change Event" is set to no.

    It is an infinite loop.

  • APEX Session point of the Application or the item of Session State set and get?

    I need assistance with items and values in a single Application-Apex:

    I have a List-Item (P101_UMGEBUNG) selected on the page of connection (Page 101) in my application (next to username and password).

    After this item has been selected in the list of outfits and the "Login" button pressed, I want to use this value of the element in the context of different select statements on other pages for example in reports to the 4 Page, like this:

    "select * from mytable where environment =: P101_UMGEBUNG;

    The select statement is faulty, it dosent go back any line. It turns out that the value I just chose in the list is not saved in session state, so of course the select statement fails.  I determine this by clicking on the session menu item in the developer bar - the item itself presents itself, but the value of the element is empty:

    Unbenannt.png

    Which would cause a selected list value not end upward in session state and how to make sure he gets there?

    I've tried different solutions (process of pl/sql, javascript actions dynamics and brances) I found here in further discussions and with google, but maybe im wrong,

    Someone has a solution for this problem and could explain it in detail?

    Hello

    Value of the item on your login page is disabled by the process of "Empty the Cache page (s)". To save the State of this element, you can:

    1. remove the "Empty the Cache" page (s) process or set the condition to "never". It security hole.

    2 create the point on another page (for example, on page 10 P10_UMGEBUNG) and create processes on the login page BEFORE the process of "Empty the Cache" page (s), which will be

    Save the State of P10_UMGEBUNG. Make the process of PL/SQL:

    BEGIN
      APEX_UTIL.SET_SESSION_STATE('P10_UMGEBUNG', :P101_UMGEBUNG);
    END;
    

    After that, you can use the value of the P10_UMGEBUNG element:

    select * from mytable where environment =:P10_UMGEBUNG;
    
  • Only display element - Session State

    APEX 4.2.2

    Display only the page element. Settings: Save Session State = Yes. Output = based on the PL/SQL code. Security > escape = No special characters.

    The PL/SQL code uses htp.p to display HTML and page is rendered fine with browser showing HTML code.

    But when the page is submitted, the value is not saved in session state is not available for the apex_mail.send process.

    What Miss me? How can I get the value of page element to be available in session state to submit after process use?

    [I tried other alternatives such as Textarea with Readonly = Always element but anyway this mess up the rendering of the code HTML. [The only thing that appears in many working on the rendering side is only show the item, but then I can't read after the value of submit processing]

    Help! Thank you.

    Hi Vikas,

    This isn't how this parameter "based on" specific is designed to work.  If you look at the underlying HTML associated with the item, you will find that the real value of the element is distinct from what is emitted from your PL/SQL code.  The output of PL/SQL is simply what you want made on the page, but it's nothing associated with the underlying session state value.  If you have a dynamically calculated in the session state for this article, you would be better to use a calculation or specify PL/SQL in the attribute 'Source value or expression.

    I don't blame yourself if you find confusing - it is certainly not clear in the documentation or the help text for item-level.

    Joel

    PS still waiting to see you at the WORLD KScope or Oracle OpenWorld.  You must be to avoid us.

  • How to set the value of the box check the plug-in in session state using a DA

    I want to click on the box (plug version) and set (Y or N) in session state without submitting the page.  Is it possible to do it in a dynamic action? or a code in the ? The HTML Form element attributes

    I tried the code proposed to

    Value of session state changes checkbox without submitting

    using AJAX, but can't make it work.

    I also tried the following code, but doesn't seem to work for checkboxes.

    <script language="JavaScript" type="text/javascript">
    function f_setItem (pItem)
    { 
    //alert('running fsetItem');
      var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',&APP_PAGE_ID.);
      get.add(pItem,$x(pItem).value)
      gReturn = get.get();
      get = null;
    }
    </script>
    

    More modern solutions using a DA?

    Should I use an event 'onCheck' or 'onchange '?

    Thanks in advance

    PaulP

    APEX V4.2.3

    DB EA 11.2

    APEX listener V2.0.5.287.04.27

    13 blue-gray theme

    IE9.0.8112

    FF26.0

    Paul, in fact, you can use a dynamic Action.

    Say your question change event, say P1_CHECKBOX.

    So here's the clincher.

    Action: execute the PL/SQL Code

    PL/SQL code:

    Start

    null;

    end;

    Page to submit items: P1_CHECKBOX

    That's all.

    Read the help on the elements of Page to submit

    «Specify a list separated by commas of the elements of the page that will be submitted to the server and therefore available for use in your 'code PL/SQL'.»

    Kofi

  • Popup LOV selected the value not in session state

    I have a pop LOV element on a page in my application.  Once the item has been selected in the list presented, I would like to use as part of a select statement.  Select statement failed.  It turns out that the value I want the popup THAT LOV is not being saved in session state, so of course the select statement fails.  I determine this by clicking on the session menu item in the developer bar - the item itself presents itself, but the value is empty.

    What would cause a popup LOV value choice not finish by in session state, and how do I make sure he gets there?

    Thank you!

    If you need the value in a SQL report, you can just set "Elements of Page to submit" in your report to your LOV element definition. Otherwise, create a dynamic fire action when your LOV is changed with a set of pl/sql null process action; then set Page elements to send to your LOV element.

    Alternatively you could do it manually with your own function/Manager javascript using the '$s' Apex API by creating a dynamic action that JavaScript is triggered then the loading of the page:

    $("#PXX_YOUR_LOV").on('change',function(){
      var getValue=$(this).val();
      $s('PXX_YOUR_LOV', getValue);
      });
    

    Changing the value in LOV only updates the HTML code, the element must be submitted to the server so that the value that will be put in session state. The gurus can explain more, but the above methods are what I use depending on the situation.

    see you soon,

    John

Maybe you are looking for