Anonymous Block in SQL Developer

I am using SQL Developer 3.1x and trying to run a pretty simple Anonymous block and am having trouble declaring a variable. This block runs successfully:
set SERVEROUTPUT on
--declare
-- V_CRT := CHR(13);
begin
for t in (select owner, table_name from dba_tables where owner = 'ABC123)
LOOP
DBMS_STATS.GATHER_TABLE_STATS(t.owner, t.table_name);
end loop;
DBMS_OUTPUT.PUT_LINE('Statistics Calculations complete');
DBMS_OUTPUT.PUT_LINE('Begin Record Counts');
-- DBMS_OUTPUT.PUT_LINE(v_crt);
-- DBMS_OUTPUT.PUT_LINE(V_CRT);
end;
If I remove my comments in an effort to include my Declare statement, I receive: PLS-00103: Encountered the symbol "=" when expecting one of the following
How do I declare / initialize the variable "v_crt"? Admittedly this is a VERY basic Block but I just started to build out a more "robust" procedure and am getting stumped.
Thank you for your help!

The symbol *:=* is for assignment, not variable declaration. Just give the variable name and then its type, like this:DECLARE
  V_CRT VARCHAR2(13);You can give it a default value if you want to.DECLARE
  V_CRT VARCHAR2(13) := 'Hello';Looks like you want it to be a carriage return character.DECLARE
  V_CRT VARCHAR2(1) := CHR(13);

Similar Messages

  • Debugging PL/SQL blocks in SQL Developer

    Is there any way to debug blocks of PL/SQL in SQL Developer by setting breakpoints in the code? I'm using SQL Developer.
    I'm trying to debug some fairly complex PL/SQL blocks - they are not procedures or functions and so I'm unable to run them in debug mode.
    p.s. Apologies should have posted this in the database forum really.
    Edited by: Antilles on Sep 10, 2008 1:12 AM

    Hello,
    Sure you can, take a look at the following two links -
    http://sueharper.blogspot.com/2006/07/remote-debugging-with-sql-developer_13.html
    http://www.oracle.com/technology/oramag/oracle/08-may/o38browser.html
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://www.apex-evangelists.com

  • Executing Procedures in sql Developer

    Hi ,
    I'm new to SQL Developer and trying to explore the tool . I have written a procedure as
    create or replace PROCEDURE SAMPLE2 AS
    studName Varchar2(8) ;
    BEGIN
    SELECT Stud1.NAME INTO studName
    FROM Stud1
    WHERE Stud1.NAME = 'SOM';
    END ;
    It has compiled perfectly .
    Now when I run by right clicking it works
    But when I'm running it using
    BEGIN
    exec SAMPLE2()
    END;
    or
    BEGIN
    SAMPLE2()
    END;
    it is giving error .
    Morover can you tell me how I can view the data after running the procedure .

    See Executing Anonymous Blocks in SQL Developer
    Remember statements always need to end with ;
    Regards,
    K.

  • SQL Developer 2.1 Debugging Anonymous block

    Is it possible to debug Anonymous PL/SQL block in SQL Developer 2.1?
    Edited by: user623569 on Oct 21, 2009 2:59 PM
    Edited by: user623569 on Oct 21, 2009 2:59 PM

    No. Vote on the [request at the Exchange|http://htmldb.oracle.com/pls/otn/f?p=42626:39:1802279917783459::NO::P39_ID:7621] to add weight for possible future implementation.
    Thanks,
    K.

  • PL anonymous block does everything, but then gets stuck

    We have a PL/SQL block that loops through a cursor, and inserts data into another table. We're having a strange issue with it... Every single line of code within it appears to function correctly... It does everything we want it to. The last line on it calls a simple function that writes a record to a table we made, to indicate it has completed. It does that, and we can see the record is inserted successfully.
    The problem: even though we can see it did everything, it gets "stuck". If we run it as a anonymous block, the sql plus session will just stay stuck. Same thing if we turn it into a procedure and invoke it. It just stays stuck. Viewing it from OEM... We can see the session as "active", but it doesn't show that it's currently executing anything.
    How can we go about figuring out what the problem is?
    We've tried it on four databases... All windows platforms.. Three were oracle 10g, one was Oracle 11g. One more interesting note: one of the 10g ones... the problem does not occur... the script finishes fine. But, we don't know what is different about this database from the others.
    We also notice the problem doesn't happen if we limit the amount of records... the initial cursor we process, if we limit it using "rownum < 100" or something like that, it will also always finish fine.
    This is the script:
    set echo on
    set serveroutput on
    declare
    n_notes_count number;
    n_records_read number;
    dt_today date;
    MYDATE DATE;
    dt_comment_date date;
    dt_updated_date date;
    t_conv_exceptions "ODB"."CONVERSION_EXCEPTIONS" %ROWTYPE;
    t_conv_exceptions_default "ODB"."CONVERSION_EXCEPTIONS" %ROWTYPE;
    t_note_pad "ODB"."NOTE_PAD"%ROWTYPE;
    t_note_pad_clear "ODB"."NOTE_PAD"%ROWTYPE;
    t_pfcomm "PMI"."PFCOMM"%ROWTYPE;
    c_created_by "ODB"."NOTE_PAD"."CREATED_BY" % type ;
    -- Exceptions to be raised
    ex_notes_number_blank EXCEPTION;
    --ex_category_not_exists EXCEPTION;
    --....more to come.....
    CURSOR cur_notes IS
    SELECT PF."MMNUM",
    PF."MMLIN",
    PF."MMDES",
    PF."MMUSR",
    PF."MMMM",
    PF."MMDD",
    PF."MMYY",
    PF."MMCC",
    --"pfcomm"."mmchr",
    --"pfcomm"."mncmn",
    --"pfcomm"."mmtype",
    PF."MMUSRU",
    PF."MMMMU",
    PF."MMDDU",
    PF."MMYYU",
    PF."MMCCU"
    FROM PMI."PFCOMM" PF
    WHERE TRIM(PF."MMDES") IS NOT NULL
    ORDER BY PF."MMNUM", PF."MMLIN";
    BEGIN
    -- Initialize variables
    dt_today := "ODB"."PKG_APPLICATION_FUNCTION"."CURRENTDATETIME";
    c_created_by :='PFCOMM';
    -- Setup defaults for exceptions table
    t_conv_exceptions_default."SCRIPT" := 'atlas_notes';
    t_conv_exceptions_default."EXECUTION_DATE" := dt_Today;
    t_conv_exceptions_default."CREATED_BY" := c_created_by;
    -- Set up header record for exception
    t_conv_exceptions := t_conv_exceptions_default;
    t_conv_exceptions.column_01 := 'NOTES';
    t_conv_exceptions.header := 'Y';
    ODB.PKG_CONVERSIONS_EXCEPTIONS.writeException(t_conv_exceptions, false);
    -- Count records in table
    SELECT COUNT(*)
    INTO n_records_read
    FROM PMI."PFCOMM";
    -- Delete previously inserted records
    DELETE FROM "ODB"."NOTE_PAD" NP
    WHERE NP."CREATED_BY" = c_created_by or NP."MODIFIED_BY" = c_created_by;
    DELETE FROM "ODB"."NOTE_PAD" NP
    WHERE NP."CREATED_BY" = 'PFCOMM2' or NP."MODIFIED_BY" = 'PFCOMM2';
    DELETE FROM "ODB"."CONVERSION_EXCEPTIONS" CV
    WHERE CV."CREATED_BY" IN (c_created_by,'PFCOMM2');
    COMMIT;
    /* Do Fetch here */
    OPEN cur_notes;
    LOOP
    FETCH cur_notes
    INTO t_pfcomm."MMNUM",
    t_pfcomm."MMLIN",
    t_pfcomm."MMDES",
    t_pfcomm."MMUSR",
    t_pfcomm."MMMM",
    t_pfcomm."MMDD",
    t_pfcomm."MMYY",
    t_pfcomm."MMCC",
    --"t_pfcommcomm"."mmchr",
    --"t_pfcommcomm"."mncmn",
    --"t_pfcommcomm"."mmtype",
    t_pfcomm."MMUSRU",
    t_pfcomm."MMMMU",
    t_pfcomm."MMDDU",
    t_pfcomm."MMYYU",
    t_pfcomm."MMCCU";
    EXIT
    WHEN cur_notes % NOTFOUND;
    -- Clear Variables
    t_note_pad := t_note_pad_clear;
    dt_comment_date := null;
    dt_updated_date := null;
    -- Begin variable assignments
    t_conv_exceptions."COLUMN_01" := t_note_pad."NOTES";
    t_note_pad."NOTES" := t_pfcomm."MMNUM";
    t_note_pad."NOTES_TEXT" := t_pfcomm."MMDES";
    -- Validate required fields
    If t_note_pad."NOTES" is null Then
    raise ex_notes_number_blank;
    End if;
    -- Sequence lines correctly
    SELECT NVL( MAX("ODB"."NOTE_PAD"."NOTES_LINE"), 0)
    INTO t_note_pad."NOTES_LINE"
    FROM "ODB"."NOTE_PAD"
    WHERE "ODB"."NOTE_PAD"."NOTES" = t_note_pad."NOTES"
    -- Next note line number to insert
    If t_note_pad."NOTES_LINE" is null Then
    t_note_pad."NOTES_LINE" := 1;
    Else
    t_note_pad."NOTES_LINE" := t_note_pad."NOTES_LINE" + 1;
    End if;
    -- MMDDCCYY - Comment Date
    If t_pfcomm."MMMM" > 0 Or t_pfcomm."MMDD" > 0 Or t_pfcomm."MMCC" > 0 Or t_pfcomm."MMYY" > 0 Then
    SELECT TO_DATE(LPAD(t_pfcomm."MMMM",2,'0') || LPAD(t_pfcomm."MMDD",2,'0') || LPAD(t_pfcomm."MMCC",2,'0')|| LPAD( t_pfcomm."MMYY",2,'0'),'MMDDYYYY') INTO dt_comment_date FROM DUAL;
    End if;
    -- MMDDCCYY - Updated Date
    If t_pfcomm."MMMMU" > 0 Or t_pfcomm."MMDDU" > 0 Or t_pfcomm."MMCCU" > 0 Or t_pfcomm."MMYYU" > 0 Then
    SELECT TO_DATE(LPAD(t_pfcomm."MMMMU",2,'0') || LPAD(t_pfcomm."MMDDU",2,'0') || LPAD(t_pfcomm."MMCCU",2,'0')|| LPAD( t_pfcomm."MMYYU",2,'0'),'MMDDYYYY') INTO dt_updated_date FROM DUAL;
    End if;
    -- Updated user information
    IF dt_updated_date is not null Then
         t_note_pad."CREATED_BY" := TRIM(t_pfcomm."MMUSRU");
         t_note_pad."CREATED_DATE" := dt_updated_date;
    Elsif dt_comment_date is not null Then
         t_note_pad."CREATED_BY" := TRIM(t_pfcomm."MMUSR");
         t_note_pad."CREATED_DATE" := dt_comment_date;
    Else
         t_note_pad."CREATED_BY" := c_created_by;
         t_note_pad."CREATED_DATE" := dt_today;
    END IF;
    /* Validate mandatory fields of TRAX table */
    IF t_note_pad.NOTES = 0 THEN
    t_note_pad.NOTES :=null;
    End If;
    IF t_note_pad.NOTES_LINE is null THEN
    t_note_pad.NOTES_LINE := 1;
    End If;
    IF TRIM(t_note_pad.PRINT_NOTES) is null Then
    t_note_pad.PRINT_NOTES := 'YES';
    END IF;
    IF TRIM(t_note_pad.NOTES_CATEGORY) is null THEN
    t_note_pad.NOTES_CATEGORY := 'NORMAL';
    END IF;
    If TRIM(t_note_pad."CREATED_BY") is null Then
    t_note_pad."CREATED_BY" := c_created_by;
    End if;
    If TRIM(t_note_pad."MODIFIED_BY") is null Then
    t_note_pad."MODIFIED_BY" := c_created_by;
    End if;
    If TRIM(t_note_pad."MODIFIED_DATE") is null Then
    t_note_pad."MODIFIED_DATE" := dt_today;
    End if;
    If TRIM(t_note_pad."CREATED_DATE") is null Then
    t_note_pad."CREATED_DATE" := dt_today;
    End if;
    -- end structure validation
    /* Do Insert here here */
    insert into "ODB"."NOTE_PAD"
    values t_note_pad;
    commit;
    END LOOP;
    dbms_output.put_line('After loop.');
    CLOSE cur_notes;
    -- Update NOTES Switch
    SELECT MAX(NT."NOTES") + 100
    INTO n_notes_count
    FROM "ODB"."NOTE_PAD" NT
    UPDATE "ODB"."SYSTEM_TRAN_CONFIG"
    SET "CONFIG_NUMBER" = n_notes_count,
    "MODIFIED_BY" = 'TRAXCNV',
    "MODIFIED_DATE" = dt_today
    WHERE ( ODB."SYSTEM_TRAN_CONFIG"."SYSTEM_TRANSACTION" = 'CONFIGURATION' ) AND
    ( ODB."SYSTEM_TRAN_CONFIG"."SYSTEM_CODE" ='NOTES' )
    COMMIT;
    dbms_output.put_line('before audit.');
    /* Do Save Audit record */
    "ODB"."PKG_CONVERSIONS_EXCEPTIONS".writeAudit(t_conv_exceptions."SCRIPT",c_created_by,n_records_read,dt_today);
    dbms_output.put_line('After audit.');
    SELECT SYSDATE INTO MYDATE FROM DUAL;
    -- Begin exception handling.
    exception
    when ex_notes_number_blank then
    t_conv_exceptions.exception_description := 'Note number is blank.';
    ODB.PKG_CONVERSIONS_EXCEPTIONS.writeException(t_conv_exceptions, false);
    when others then
    t_conv_exceptions.exception_description := substr(SQLERRM,1,1000);
    ODB.PKG_CONVERSIONS_EXCEPTIONS.writeException(t_conv_exceptions, false);
    RAISE;
    -- End exception handling.
    dbms_output.put_line('before end.');
    END ;
    /

    Avoid row-at-a-time processing if at all possible (cursor for loops, periodic commits, etc).
    Try adding some calls to dbms_application_info.set_module (or set_action) in order to find out where your code is.

  • Oracle SQL Developer 3.0: PL/SQL debugging of anonymous blocks: ISSUES

    Hello,
    I just downloaded the Oracle SQL Developer 3.0. I have been using the EA releases as they came into existence and was happy to see the released version. So I immediately tried to debug an anonymous block (something I did not try to do in the EA releases), and nothing happened.
    The "Debug" was grayed out and the key-chord "ctrl-shift-F10" did nothing. I found this forum:
    Re: 30EA1: anonymous block debugging?
    and followed Vadim Tropashko's advice. This did nothing for my anon. block but worked fine for the simple example.
    So I started to whittle my anon. block down to find the culprit, here is a repeatable breaking point for me:
    declare
        stmt1 long;
        stmt2 long;
        stmt3 long;
        stmt4 long;
        p_data varchar2( 500 );
        i      varchar2( 10 );
    BEGIN
        STMT1 := 1;
        STMT2 := 1;
        STMT3 := 1;
        STMT4 := 1;
        --the moment this is in the block "Debug" is no longer an option
         select
            SendDocumentResult
           into
            p_data
           from
            XMLTABLE( '/data'
                    PASSING
                    xmltype.createxml( '<?xml version="1.0" encoding="utf-8"?><data><SendDocumentResult>test</SendDocumentResult></data>' )
                    COLUMNS SendDocumentResult varchar2( 1000 ) PATH 'SendDocumentResult' ) ;
    end;The moment I have the SELECT INTO ... XMLTABLE() it fails (a normal SELECT INTO works just fine).
    Is this a problem with my environment or is a problem with SQL Developer 3.0.04. Looking over K's comments, it seems the debug worked for 'simple' blocks, so I wonder if this is just out-of-scope...
    My environment:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production    
    PL/SQL Release 11.2.0.1.0 - Production                                          
    CORE     11.2.0.1.0     Production                                                        
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production               
    NLSRTL Version 11.2.0.1.0 - Production
    and Oracle SQL Developer
    3.0.04 (Buld Main 04.34 with bundled Java) on a Window's XP box.

    Thanks, I'll survive. Just my luck, the first item I try to anon. debug didn't work! :)
    thanks, hopefully this problem will be few and far between

  • Using Create table command in a Pl/Sql Anonymous Block

    Hi,
    I need to create a table dynamically based on the table_name and column_names that a user wants. When I use a Pl/sql Anonymous block to do this, it complains. Any suggestions ?
    Thanks,
    Marisa

    Personally this sounds like a bad design to me. I would say under most "normal" circumstances, you should not be creating tables on the fly. Especially one where a user has control over what columns,datatypes to use. Let a developer or dba take care of that.

  • Reference value of an SQLPLUS variable in a PL/SQL anonymous block

    All,
    Is there a way of referencing an SQLPLUS variable within a PL/SQL anonymous block. See my example below........
    sqlplus -s /@${L_DB_SID} <<-ENDOFSQL >> ${L_LOGFILE}
    SET FEEDBACK OFF
    SET PAGES 0
    SET SERVEROUTPUT ON
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    WHENEVER OSERROR EXIT 2
    VARIABLE l_ret_sts NUMBER;
    VARIABLE l_ret_msg VARCHAR2(300);
    exec sh_plsql_owner.sh\$secure_batch.p\$set_role(p_ret_sts => :l_ret_sts);
    begin
    if :l_ret_sts > 0 then
    dbms_output.put_line('l_ret_sts:'||:l_ret_sts||':SECURITY');
    else
    ${L_PLSQL_PROG}(p_ret_type => 0, p_ret_sts => :l_ret_sts, p_ret_msg => :l_ret_msg);
    dbms_output.put_line('l_ret_sts:'||NVL(:l_ret_sts,0));
    dbms_output.put_line('l_ret_msg:'||:l_ret_msg);
    end if;
    end;
    exit
    ENDOFSQL
    I need to be able to reference :l_ret_sts in the begin block using the if statement "if :l_ret_sts > 0 then"
    :l_ret_sts is populated in a procedure call beforehand.
    However it seems as though the begin block cannot reference the value returned to :l_ret_sts.
    Any ideas.
    Ian.

    Managed to solve this. I put my call to the package that the role enables via dynamic sql....
    sqlplus -s /@${L_DB_SID} <<-ENDOFSQL >> ${L_LOGFILE}
    SET FEEDBACK OFF
    SET PAGES 0
    SET SERVEROUTPUT ON
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    WHENEVER OSERROR EXIT 2
    VARIABLE l_ret_sts NUMBER;
    VARIABLE l_ret_msg VARCHAR2(300);
    exec dbms_application_info.set_client_info('CONTROL-M');
    exec sh_plsql_owner.sh\$secure_batch.p\$set_role(p_ret_sts => :l_ret_sts);
    declare
    v_text varchar2(500);
    begin
    if :l_ret_sts > 0 then
    dbms_output.put_line('l_ret_sts:'||:l_ret_sts||':SECURITY');
    else
    v_text := 'begin ${L_PLSQL_PROG}(p_ret_type => 0, p_ret_sts => :1, p_ret_msg => :2);end;';
    execute immediate v_text using in out :l_ret_sts, in out :l_ret_msg;
    dbms_output.put_line('l_ret_sts:'||NVL(:l_ret_sts,0));
    dbms_output.put_line('l_ret_msg:'||:l_ret_msg);
    end if;
    end;
    exit
    ENDOFSQL
    Cheers
    Ian.

  • SQL Developer blocking vs non-blocking

    Hi,
    Is there a way in SQL Developer 3.0 to have a non-blocking SQL call? In Oracle Forms we can choose between blocking and non-blocking SQL Net connections to the database. Does SQL Developer have the same capability? If so where exactly are those options hidden in the preferences menus?
    Annoyed,
    ScottK
    Edited by: ScottK on Jun 1, 2011 11:20 AM

    Hi ScottK,
    SQLDeveloper locks access to individual connections when they are in use, if you want to simulate
    some aspects of non blocking behaviour you can use other connections.
    The following features might help:
    Use a different connection name back to the same schema in your database - it will be treated as an independent connection and 'blocking' on this connection will not affect your other connections.
    This can be achieved temporarily in the worksheet by:
    ctrl shift n
    which creates a worksheet with new connection independent of your existing worksheet connection
    though connected to the same schema and database.
    -Turloch
    SQLDeveloper team

  • Calling PL/SQL anonymous block from href in tabular report

    apex 2.2.
    I've got a tabular report where I've added some img columns with a href to call diff processes
    for example
    "<a href="f?p=&APP_ID.:22:&APP_SESSION.:BRANCH_TO_PAGE_ACCEPT|NEW_PROXY:NO:::22,ABCDEF ><img src="/i/asyl.gif" border="0" alt="Runprocess"></a>"
    When clicking on an image column in row x then I would like to run the process - no page submit.
    The pl/sql anonymous block process source calls package.storedproc(p1,p2) - two in parameters
    I'm struggling with the syntax and is wondering if there's a smarter way to achieve the same function
    Any ideas most welcome
    Thanks
    Peter

    &lta href="f?p=&APP_ID.:22:&APP_SESSION.:BRANCH_TO_PAGE_ACCEPT|NEW_PROXY:NO:::22,ABCDEFG" &gt&ltimg src="/i/asylogin.gif" border="0" alt="Process"&gt&lt/a&gtQuestion is how can you pass values from a row in a tabular report to the application process ?

  • Autonomous Transactions usage in PL/SQL anonymous block coding

    Hi,
    I am trying to incorporate Autonomous Transaction for our work. I am using the tables provided below,
    CREATE TABLE T1
    F1 INTEGER,
    F2 INTEGER
    CREATE TABLE T2
    F1 INTEGER,
    F2 INTEGER
    insert into t1(f1, f2)
    values(20, 0)
    insert into t2(f1, f2)
    values(10, 0)
    Now, when I use the code snippet given below, it is working as expected.
    create or replace procedure p1 as
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
         update t2
         set f2 = 25
         where f1 = 10;
         commit;
    end;
    declare
    PRAGMA AUTONOMOUS_TRANSACTION;
    a integer;
    begin
         update t1
         set f2 = 15
         where f1 = 20;
         p1();
         rollback;
    end;
    Here, updation in t2 table is commited and t1 is rolled back, it is working as
    expected. I would like to achieve the same functionality through PL/SQL
    anonymous block coding, to do this, I use the following code snippet,
    declare
    PRAGMA AUTONOMOUS_TRANSACTION;
    a integer;
    begin
         update t1
         set f2 = 15
         where f1 = 20;
         begin
              update t2
              set f2 = 35
              where f1 = 10;
              commit;
         end;
         rollback;
    end;
    Here, data in both the tables are commited, how do I change it to work as I
    mentioned above like committing t2 alone, please help, thank you.
    Regards,
    Deva

    Can you explain what you're trying to accomplish from a business perspective? This doesn't look like a particularly appropriate way to use autonomous transactions, so you may be causing yourself problems down the line.
    That said, padders's solution does appear to work for me
    SCOTT @ nx102 Local> CREATE TABLE T1
      2  (
      3  F1 INTEGER,
      4  F2 INTEGER
      5  )
      6  /
    Table created.
    Elapsed: 00:00:01.03
    SCOTT @ nx102 Local>
    SCOTT @ nx102 Local>
    SCOTT @ nx102 Local> CREATE TABLE T2
      2  (
      3  F1 INTEGER,
      4  F2 INTEGER
      5  )
      6  /
    Table created.
    Elapsed: 00:00:00.00
    SCOTT @ nx102 Local>
    SCOTT @ nx102 Local> insert into t1(f1, f2)
      2  values(20, 0)
      3  /
    1 row created.
    Elapsed: 00:00:00.01
    SCOTT @ nx102 Local>
    SCOTT @ nx102 Local> insert into t2(f1, f2)
      2  values(10, 0)
      3  /
    1 row created.
    Elapsed: 00:00:00.01
    SCOTT @ nx102 Local> commit;
    Commit complete.
    Elapsed: 00:00:00.01
    SCOTT @ nx102 Local> DECLARE
      2     a INTEGER;
      3 
      4     PROCEDURE update_t2
      5     IS
      6        PRAGMA AUTONOMOUS_TRANSACTION;
      7     BEGIN
      8        UPDATE t2
      9           SET f2 = 35
    10         WHERE f1 = 10;
    11 
    12        COMMIT;
    13     END update_t2;
    14  BEGIN
    15     UPDATE t1
    16        SET f2 = 15
    17      WHERE f1 = 20;
    18    
    19     update_t2;
    20 
    21     ROLLBACK;
    22  END;
    23  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04Have you done something else that would cause a deadlock?
    Justin

  • How come the item value does not come thru via PL/SQL anonymous block?

    Hi,
    It's a Form with 3 tables -
    1) ClinicianProfileTb (with about 40 columns, insert/update via DML),
    2) PeopleTb (with about 7 columns, insert/update via PL/SQL anonymous block) and
    3) ClinicianPracticeTb (with about 10 columns, insert/update via PL/SQL anonymous block) for after-submit-processes.
    So I have several After-Submit-Processes. For some reason, it appears that PeopleId which is supposed to come thru via the 2nd After-Submit-Process (ie: Insert/Update PeopleTb) does not do the way it's supposed to. And when I press "Create" button at the bottom, I got the following error msg:
    ORA-01400: cannot insert NULL into ("TEST_0712"."CLINICIANPRACTICETB"."PEOPLEID")
    I tried the "debug" mode (via edit page link), but to no avail. (I'm newbie, trying to learn and deliver at the same time :)).
    I uploaded the app to apex.oracle.com, if someone could kindly take a look and let me know what goes wrong, it'd be greatly appreciated.
    workspace: test_0712
    app: 43408 - TEST
    user: demo
    pswd: demoPswd
    Page#21 -> look at the After-Submit-Processes -> in "Insert/Update PeopleTb" it appears that PeopeId does not come thru; thus it cannot be updated to ClinicianProfileTb.PeopleId (allows null) -> and thus cannot be inserted into ClincianPracticeTb.PeopleId (which does NOT allow null). Basically my logic is that in order to create ANY row in ClinicianPracticeTb, BOTH PracticeId AND PeopleId must be present.
    Acutally I should have used the PeopeTb as DML (as the driving table) to enforce that PeopleId must be present in order to insert ClinicianProfileTb and ClinicianPracticeTb, but it'd be lots of codes to write to insert/update in ClinicianProfileTb (40 columns).
    In addition, does ApEx consider EVERY SINGLE after-submit-process are in ONE transaction for commit/rollback? It appears that it treats all PL/SQL anonymous blocks are in ONE transaction, while Automatic Row Processing (DML) is commited/rolled back on its own?
    Thanks much,
    Helen

    All blocks that do not commit in one of the ways I detailed (and which do not explicitly commit using a commit statement) are part of the transaction started with > the first DML statement issued in any of the page processes and continuing until a commit is issued.Say, there are the following processes in the After-Submit-Processes:
    1. Process1 -> Automatic Row Processing (DML)
    2. Process2 -> PL/SQL anonymous block
    3. Process3 -> PL/SQL anonymous block
    Based on what you describe, in the event that if there is no explicit "commit" issued in any of these processes, then an implicit "commit" will be issued at the end of Process3?
    Thanks, Scott.
    Doreen

  • Block selection in SQL Developer?

    Hey everyone! A co-worker of mine uses TOAD to do work with our databases, however I use SQL Developer as I like it very much. During one of our meetings, he used something called "Block Selection" (I think that's what it's called....) in his code editor, by holding down ALT and highlightning a 'block' of text. This made it so he wouldn't grab text line by line.
    I thought it was very cool, and it would be extremely helpful to clean up and format a bunch of procedures I have. I use a monospaced font to keep everything "in line" so to speak....makes it easier to read, especially in very large packages. Anyone know if SQL Developer supports this capability? Been searching all over for it on google, and through all the SQL help files but havn't found anything. Could be that I just don't know what to look for. Help would be appreciated!

    It's in the older versions of SQL Developer as well
    http://www.thatjeffsmith.com/archive/2012/07/how-to-block-select-text-in-oracle-sql-developer/
    What's weird is in 4.0, it doesn't work when 'block select' is enabled, but DOES work when it's not enabled....unless I'm reading that backwards.

  • Help!! how to call pl/sql anonymous block from java?

    I know that jdbc can call a pl/sql package or procedure,but if i
    want to call a pl/sql anonymous block, how can i do it? no procedure
    name or package name will be offered.
    Can u give me a sample code? thanks very much

    thanks ,but do u make sure that it can work? i have tried to do like this ,but i can not get it. Or please give me a detail code, thanks very much

  • Need help displaying item based on pl/sql anonymous block

    This is probably something really simple but I'm stuck.....
    On purchase order, I want to show related parent project name and ID. What is the best way to do it? I have created a region based on pl/sql anonymous block, and that works, but the data is above where I want it. I want the project name and ID to show up in the region w/ all the other fields.
    I have created an item in the region that has other form fields, item is based on pl/sql anonymous block, w/ same code as above region, and the item doesn't find the data. What's the difference? Is it because the item doesn't save state? In order to choose for the item to be based on pl/sql anon block, APEX made me choose Display as Text (based on PLSQL, does not save state).
    Please see this picture:
    http://farm3.static.flickr.com/2391/2658673285_04f157a3fa_o.png
    thanks!
    ~Darby

    this is weird.. Now it is working. I didn't change anything! What the heck?
    http://farm3.static.flickr.com/2010/2659557520_73e54b67ea_o.png

Maybe you are looking for