By the way the Pls/Sql variable to build xml via XQuery code

v_ID number (3): = 5;

v_UserID nvarchar2 (5): = 'abc ';

v_Password nvarchar2 (8): = "passw0rd"

v_Panel nvarchar2 (20): = "AppPnl";

v_loginFailReason nvarchar2 (200): = 'IUIP | Invalid user or password ID ';

v_SpParam xmltype: = XMLTYPE ("< QueryParam / > '");

SELECT Xmlquery (' for $el in /QueryParam)

return < QueryParam > {Rec <>

< EmpID > {$ID} < / EmpID >

< user name > {$UserID} < / UserID >

< password > {$Password} < / password >

< sign > {$Panel} < / sign >

< reason > {$loginFailReason} < / reason >

AppLogin < callde > < / callde >

{< / rec >}

< / QueryParam > '

Passage v_SpParam

, v_ID AS "ID".

, v_UserID AS "UserID".

v_Password AS 'Password'

, v_Panel AS 'Panel '.

, v_loginFailReason AS 'loginFailReason '.

RETURN CONTENT)

in the double v_SpParam;

OPEN rc to SELECT v_SpParam FROM dual;

DBMS_SQL.return_result (RC);

the result is:

< QueryParam >

< rec >

< EmpID > 5 < / EmpID >

< user name > < / UserID >

<>password < / password >

< sign > < / sign >

< reason > < / reason >

AppLogin < callde > < / callde >

< / rec >

< / QueryParam >

Pls. Let me know how I move correctly variable to build xml code, I don't get values in the xml result.

Should you variables defined as nvarchar2, for a particular reason?  Switching to simply varchar2 allows to operate as you (in 11.2.0.4).  Right now, I'm not sure of the solution correct nvarchar2.

Tags: Oracle Development

Similar Questions

  • How to assign the pl/sql variable to a variable of the page element?

    I want to select count (*) in the emp table.

    assign this count (*) total to a pl/sql variable.

    How can I assign this varialbe pl/sql variable of page element?

    : p2_test = pl_total;

    Thank you.

    Good afternoon

    Try this:

    1. create a process Page:

    Declare
    pl_total number;
    Begin
    select count(*)
    into pl_total
    from emp_table;
    :P2_test := pl_total;
    End;

    Or a simpler approach:


    Begin
    select count(1)
    into :P2_test
    from emp_table;
    End;

    If you use count (1) rather that count (*), you do the inventory column 1 and not the entire file. Oracle then reads just column 1 instead of the whole of the record, speed up your query, if the table can have a large number of columns AND a lot of files.

    Good luck
    Don.

    You can reward this answer by marking as being useful or correct :)

  • What is the use of SOA project build.xml

    Hi all

    I am new to this area of oracle SOA.
    could you please explain to me what is the purpose of build.xml and build.property in soa project files.

    Thanks in advance...

    Hi '.

    Helps these two files in the deployment of the project to the server, usually in the phase of development projects are deployed through JDeveloper.
    In Jdev we right-click and here also deploy these files are used to deploy the jar of project. These files do the same work as any other web project
    File Build.xml and property.xml.

    Yatan-

  • Content in the new text variable

    Hi, I nees to help.

    I need to set a number in the new text variable 'number ':

    I have this code work:

    say myDoc

    set txt1 to do new variable text {propertyname: 'number"}

    end say

    How can I put content in the text variable?

    Hi David,

    You can do...

    Tell application "Adobe InDesign CS5"

    myDoc defined for the active document

    say myDoc

    txt1 to make the new text with the properties variable value {name: "Number"}

    Set the content for '123 '.

    define the content of the variable variable text options 'number' to the content

    -or

    content of the variables txt1 options value content

    tell the end

    tell the end

    Concerning

    Ronald

  • How to pass Variables from the Source (SQL) to tab target (JavaBin Shell) in ODI knowledge Modules

    Hi all

    My name is Alessandro and I am new to the community.

    I have a problem with the KM stage custom when I try to pass the variable from the source to the target.

    The ODI version tha I use is the 11.1.1.5.0.

    I created a stage KM following the instructions of the metalink document (Doc ID 728636.1).

    But when I insert the value of the variable in a test table, the value in a table is the name of the variable.

    Where I'm wrong?

    I am doing thi.

    (1) create a step in my goal of shell sql source and javabin KM. In the source tab I get the value of a query, and the name "LAST_UPDATE" column.

    In the target tab, I attribute to the variabile jv_last_update the value of the variable #LAST_UPDATE, with the same name in the selection column.

    source_tab.jpgtarget_tab.jpg

    (2) I created a second stage where I insert into a table of the value of the variable jv_last_update (to debug the value of the variable):

    insert_step.jpg

    (3) when I try to see what I have in the table, the value of any line is the name of the variable "#LAST_UPDATE"; ".

    result_table.jpg

    Thanks in advance


    Alessandro

    Hi Alessandro,.

    Interesting... I have not read the Oracle document you sent yet, but one thing I can guarantee you, is that it doesn't. If Oracle says that it should work, maybe it's a bug, or maybe he has changed on new versions of ODI. I am also on ODI 11.1.1.5 and I tried many different ways to pass SQL results to variables of java with all sorts of different labels, but none of them worked for me as well. But I managed to use it in a different way, so please see below if it matches your needs:

    We are just one step. The second is just to show that it worked:

    In the first step, on the source tab, select Oracle and point to the logical schema that you want to run the query:

    On the target, note the following Java BeanShell code with the SQL that you want to run:

    Now your variable must have the correct value of your SQL. To test it, I just write a comment 'Raise' to Jython in the second step:

    The result is 'X' as expected:

    It will be useful.

    Thank you!

  • Question on the PL/SQL and substitution of variables

    Good evening

    I just started studying the PL/SQL (currently at page 13 of the book), I typed the following example from the book:
    declare
      v_student_id          number          := &sv_student_id;
      v_first_name          varchar2(35);
      v_last_name           varchar2(35);
    
    begin
      select first_name,
             last_name,
        into v_first_name,
             v_last_name
        from student
       where student_id = v_student_id;
    
    
      dbms_output.put_line('Student name : ' || v_first_name || ' ' v_last_name);
    
      exception
        when no_data_found then
          dbms_output.put_line('There is no such student');
    end;
    /
    that gets me the following error:
    SP2-0552: Bind variable "SV_STUDENT_ID" not declared.
    I thought that SQL * more would invite me for a value to be substituted for SV_STUDENT_ID but it does not, that caused the error. Why has no SQL * more invite me for the value of SV_STUDENT_ID and what is the correct way to do it than the code above?

    Thank you for your help,

    John.

    As a result, DDL for STUDENT table:
    CREATE TABLE STUDENT
     (STUDENT_ID NUMBER(8,0)
     ,SALUTATION VARCHAR2(5)
     ,FIRST_NAME VARCHAR2(25)
     ,LAST_NAME VARCHAR2(25)
     ,STREET_ADDRESS VARCHAR2(50)
     ,ZIP VARCHAR2(5)
     ,PHONE VARCHAR2(15)
     ,EMPLOYER VARCHAR2(50)
     ,REGISTRATION_DATE DATE
     ,CREATED_BY VARCHAR2(30)
     ,CREATED_DATE DATE
     ,MODIFIED_BY VARCHAR2(30)
     ,MODIFIED_DATE DATE
     )
    /

    You had a few syntax errors (lines 7 and 12), but after their attachment, your code worked for me:

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_student_id          number          := &sv_student_id;
      3    v_first_name          varchar2(35);
      4    v_last_name           varchar2(35);
      5  begin
      6    select first_name,
      7           last_name
      8      into v_first_name,
      9           v_last_name
     10      from student
     11     where student_id = v_student_id;
     12    dbms_output.put_line('Student name : ' || v_first_name || ' ' || v_last_n
    ame);
     13    exception
     14      when no_data_found then
     15        dbms_output.put_line('There is no such student');
     16* end;
    SQL> /
    Enter value for sv_student_id: 1
    old   2:   v_student_id          number          := &sv_student_id;
    new   2:   v_student_id          number          := 1;
    
    PL/SQL procedure successfully completed.
    

    Did you happen to define set off?

    SQL> show define
    define "&" (hex 26)
    
    SQL> set define off
    SQL> /
    SP2-0552: Bind variable "SV_STUDENT_ID" not declared.
    SQL> set define on
    SQL> /
    Enter value for sv_student_id: 1
    old   2:   v_student_id          number          := &sv_student_id;
    new   2:   v_student_id          number          := 1;
    
    PL/SQL procedure successfully completed.
    

    Published by: Andy Klock on August 11, 2010 18:13 (sorry, line 7 means there was an error not 9...)

  • Possible bug - PLS-00372 creating BODY calculation of the PL/SQL FUNCTION

    3.2 on Oracle APEX: 10 x e

    I was creating a calculation for a page element by using the type 'BODY of the PL/SQL FUNCTION '. Step by step in the wizard when I entered my code block, I received the error PLS-00372. Here is the code:

    DECLARE
    l_return person_v.full_name%TYPE: = 'UNKNOWN ';
    BEGIN

    SELECT full_name
    IN l_return
    OF person_v
    WHERE party_id =: P230_CONTACTED_PARTY_ID;

    RETURN l_return;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RETURN l_return;
    END;

    If I change my name of the variable to another thing that l_return the error disappears. Later, I can't change the name of the variable in l_return and I do not get the error if it seems to be the validation happening on just this page of the wizard.

    Greg - it's because of a quirk in the validation, like imagine you. Workaround is to put a space between return characters and the terminal semi-colon, for example:

    RETURN l_return;

    Scott

  • Looking for ways to solve the following problems of these messages: "check the temp environment variable. "Unable to print the document. "You don't have permission to save in this location."

    Looking for ways to solve the following problems of these messages: "check the temp environment variable. "Unable to print the document. "You don't have permission to save in this location."

    Hi Michael,

    Please follow the link and see the issue:

    Cannot print or preview before printing a Web page in Internet Explorer: http://support.Microsoft.com/kb/973479

    If the problem is specific to MS Word, then I suggest you to post the same question in the forums of MS Office for assistance.

    Microsoft Office Forum:

    http://answers.Microsoft.com/en-us/Office/Forum/Word

    I hope this helps.

  • What is the right way of javadoc a variable-length argument list

    What is the right way of javadoc a variable-length argument list?

    Let's say I have the following function:
    public void foo(Integer... intArray){
    //...
    }
    I'm not sure how I would want doc this, well, is there something special, I want to point out?

    Thank you for your time,
    Brandon

    Identical to another argument. Name it and say what's the point.

  • Reading the value of a PL/SQL variable

    Hello

    I have a requirement where I need to read the contents of a pl/sql variable and then write in an operating system file. a .sql or .txt file.

    What can I do with it?

    Any help will be much appreciated.

    Kind regards
    SID

    Hello

    Example script e.r.y

    DECLARE
    v_output UTL_FILE.FILE_TYPE;
    CURSOR c1
    IS
    select cust_cod,mobile_no
    from main_master
    where rownum <11;
    BEGI
    v_output:=UTL_FILE.FOPEN('/rman/report/textfiles/','OUTPUT_DATA.TXT','W');
    /**You should have write permission to write onto direcotry /rman/report/textfiles ***/
    FOR i IN c1
          LOOP
    UTL_FILE.PUT_LINE(v_output,i.cust_cod||'  '||i.mobile_no);
    END LOOP;
    UTL_FILE.FCLOSE(v_output);
    END;
    

    Kind regards
    Claudy

  • PL/SQL variable authorized problem of lengths in the superior version.

    Hi all
    Before entering my problem here is two different versions of DBs.

    DB1:
    ===========
    SQL * more: release 9.2.0.1.0
    Oracle Database 10 g Enterprise Edition Release 10.2.0.3.0 - 64 bit
    PL/SQL version 10.2.0.3.0 - Production
    CORE Production 10.2.0.3.0
    AMT for Linux: release 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production



    DB2:
    ===========
    SQL * more: 9.2.0.5.0 output
    Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0 - 64 bit
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for Linux: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    My problem is a plsql block works well in DB1 (which is a lower version) is any error in DB2 (which is the latest version).

    Here is the block that I run and I have just listed under the same results. Please advise me on porting code from DB1 to DB2.

    Program:
    DECLARE
    l_var1 VARCHAR2 (32767).
    CLOB l_clob_var1;
    CLOB l_clob_var2;
    CLOB l_clob_var3;
    CLOB l_clob_var4;
    l_position NUMBER;
    BEGIN
    l_position: = 0;
    FOR I IN 1.8191 LOOP - it comes (2 to the power of 13) - 1
    l_clob_var1: = l_clob_var1 | « a » ;
    END LOOP;
    l_position: = 1;
    FOR I IN 1.8192 LOOP
    l_clob_var2: = l_clob_var2 | « a » ;
    END LOOP;
    l_position: = 2;
    FOR I IN 1.8193 LOOP
    l_clob_var3: = l_clob_var3 | « a » ;
    END LOOP;
    l_position: = 3;
    FOR I IN 1.8617 LOOP
    l_clob_var4: = l_clob_var4 | « b » ;
    END LOOP;
    l_position: = 4;
    l_var1: = l_clob_var1;
    l_position: = 5;
    l_var1: = l_clob_var2; -Error reported for this DB2. Observe the position value 5 below results.
    l_position: = 6;
    l_var1: = l_clob_var3;
    l_position: = 7;
    l_var1: = l_clob_var4;
    l_position: = 8;
    dbms_output.put_line ('No errors reported');
    l_position: = 9;
    EXCEPTION
    WHILE OTHERS THEN
    RAISE_APPLICATION_ERROR (-20999,' error at position ' | l_position |', SQLERRM: ' |) SQLERRM);
    END;
    /

    Results:
    ======================================================
    DB1:
    ======================================================
    No error reported

    PL/SQL procedure successfully completed.

    All variable lengths up to 32767 are allowed here.


    DB2:
    ======================================================
    DECLARE
    *
    ERROR on line 1:
    ORA-20999: error at position 5, SQLERRM: ORA-06502: PL/SQL: digital or the value
    error
    ORA-06512: at line 38 level

    PLSQL variable length up to 8191 ((2 to the power of 13)-1) characters are allowed here.

    Thank you.
    Mahi.

    NVARCHAR2 has little magic? It will NOT work. :)

    SQL> DECLARE
      2    l_var1      NVARCHAR2(32767);
      3    l_clob_var1 CLOB;
      4    l_clob_var2 CLOB;
      5    l_clob_var3 CLOB;
      6    l_clob_var4 CLOB;
      7    l_position  NUMBER;
      8  BEGIN
      9    FOR i IN 1 .. 8191 LOOP
     10      -- This is (2 to the power of 13 )-1
     11      l_clob_var1 := l_clob_var1 || 'a';
     12    END LOOP;
     13    FOR i IN 1 .. 8192 LOOP
     14      l_clob_var2 := l_clob_var2 || 'a';
     15    END LOOP;
     16    FOR i IN 1 .. 8193 LOOP
     17      l_clob_var3 := l_clob_var3 || 'a';
     18    END LOOP;
     19    FOR i IN 1 .. 8617 LOOP
     20      l_clob_var4 := l_clob_var4 || 'b';
     21    END LOOP;
     22    l_var1 := l_clob_var1;
     23    l_var1 := l_clob_var2; ---- Error reported for this in DB2. Observe the position value 5 in below results.
     24    l_var1 := l_clob_var3;
     25    l_var1 := l_clob_var4;
     26    dbms_output.put_line('No Errors reported');
     27  END;
     28  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 23
    
  • Best way to write the Pl/Sql

    Hi all
    Can someone say best written below stored proc:

    procedure missing_authorized_services is
    v_truncate_sql varchar2 (200);
    v_sql varchar2 (2000);
    BEGIN
    v_truncate_sql: = "truncate table missing_authorized_services;
    immediately run v_truncate_sql;
    commit;

    v_sql: = "INSERT into missing_authorized_services select distinct trim (service_group_Cd) as service_group_Cd, trim (service_cd) as stage_1_mg_service_request service_cd
    where (service_group_cd, service_cd) not in)
    Select distinct service_group_cd, stage_3_servcd_servgrp_dim service_cd)';

    immediately run v_sql;
    commit;

    END missing_authorized_services;


    / * I do select the table and then try to insert into another table the result set * /.

    Please help,
    Thank you
    J

    Hello

    The best way to write the PL/SQL (or any code) is by small steps.
    Start with a very simple procedure that does something (anything), just enough to make sure it works.
    Add a lot of statements of output so you can see what made the procedure. Don't forget to delete them after that trial is over.

    For example:

    CREATE OR REPLACE procedure missing_authorized_services IS
            v_truncate_sql  VARCHAR2 (200);
    BEGIN
         v_truncate_sql := 'truncate table missing_authorized_services';
         dbms_output.put_line (  v_truncate_sql
                        || ' = v_truncate_sql inside missing_authorized_services'
                        );
    END      missing_authorized_services;
    

    If you get any errors (for example, ORA-00955, because you try to give the same name to a procedure that you already use for a table), then fix the error and try again.
    When he worls perfectly, then add another baby step. For example, you can add the line

    EXECUTE IMMEDIATE v_truncate_sql;
    

    and test again.

    Do not use SQL dynamic (EXECUTE IMMEDIATE) unless you have to.
    Is there a reason to use dynamic SQL for INSERT statements?

  • global scope &amp; pl/sql variable in open_form with the new session

    Hello

    What will be the global scope of the Oracle variable shape & variable declared in a pl/sql pckage, if the value of these variables is updated from the form interface Oracle, if the form is opened using open_form with the new session or a session Active.

    My requirement is, I developed an application with custom user login name & password - not the Oracle username and password.
    But I need follow the user actions on forms - action insert/update / delete, for this user_name i included as one of the column in the table base and shape, initialize this field with the login user name.

    I have implemented this in the detent of the base table. But to remove them, I don't get the username which were deleted, only for the user who created this folder, because that: NEW is not in the scope according to the delete trigger. So for the delte, I created a variabe in a PL/SQL package and created two procedure to set and get the username to this variable, and form, before you delete using the set method I assign the user name of the current connection to the variable and in the trigger using the get() method get the user name from the variable , Until now it works very well, my doubt is what will be the value of the variable, if two different users delete action of in same time, if the first user name will be replaced by second or this variable will be different session, if I opened the forms using the SESSION parameter. Also can I use Oralce forms global variable instead of the PL/SQL varibale.

    I thank in advance.

    The scope of a package-db variable is per database session. So different forms-session or even different DB - inside a session of forms "will not overwrite" between them.

  • How the sql query to sort the records by variable

    Feel like using PHP to know how to write the query SQL ORDER BY
    value time from list/menu form field ("sort_menu") and the values in the list are the columns of the database

    SELECT *.
    OF rentals_info
    WHERE rentals_info.active = 'yes '.

    Thanks for your help,
    Jim balthrop

    JBWebWorks wrote:
    > Using fault PHP to know how to write the query to sql ORDER BY
    > run time value from list/menu form field ("sort_menu") and the list
    > values of the database columns

    Unfortunately, you can not use the Dreamweaver Recordset dialog box to set
    a column of the table as a variable. You need to adapt the code by hand, and
    Once you do, the recordset can be is no longer recognized by
    Dreamweaver. Thus, you must have first page in case the
    Bindings panel shows more the fields in your recordset.

    Begin by creating the Recordset without the ORDER BY clause and have
    your page as you want it. When everything is done, add the following
    code at the top of the page:

    <>
    create a table of column names that can be used for sorting
    $permitted = array ("price", "space");
    checks if the sort_menu variable contains a valid column name
    If (isset($_GET['sort_menu']) & in_array ($_GET ['sort_menu'], $permitted)) {}
    $sort = $_GET ['sort_menu'];
    } else {}
    the value of a default column for sorting
    $sort = "price".
    }
    ?>

    This assumes that the sort columns are called price and region.
    Change these values according to your configuration.

    You can now add ORDER BY $sort to the SQL of the Recordset.

    --
    David powers
    Adobe, Dreamweaver community expert
    http://foundationphp.com

  • How to read a file of all the text in a pl/sql variable?

    Hi, I need to read an entire text file - which actually contains an e-mail message from a system of content management - in a variable in a pl/sql package, in order to insert the database information and then send the email. I want to read the whole of a sudden text file, no not one line at a time. Shoud I use Utl_File.Get_Raw or is there a more appropriate to do this?

    How to read a file of all the text in a pl/sql variable?

     ...
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....
    

Maybe you are looking for