How to pass parameter in the function extract (for XMLTYPE)

I have a table with XMLTYPE field xml_column PROBLEMXML. In this column, there are many deffinitions for the problem. There is no amount deffinitions max and there can be no definition at all. I need to return all the definitions of all the problems a string wirh separate definitions by '; '.

Query
SELECT extract (prob. Def,'/definitions/definition[1]/@var'). ';'|| excerpt (prob. Def,'/definitions/definition[2]/@var')
OF PROBLEMXML j.
XMLTABLE)
"/ problem.
PASSAGE j.xml_column
Probid VARCHAR COLUMNS (31) PATH ' / problem/@id',
Prob def XMLTYPE PATH ' / problem/definitions ")
where PROBLEM_ID = 1;
Returns exactly what I want one; m.
But
declare
my_variable varchar2 (2000): = null;
number of N1;
number of N2;
Start
N1: = 1;
N2: = 2;
SELECT extract (prob. Def,'/definitions/definition[N1]/@var'). '|'|| excerpt (prob. Def,'/definitions/definition[N2]/@var') in my_variable
OF ETL_PROBLEMXML_STG_T j.
XMLTABLE)
"/ problem.
PASSAGE j.xml_column
Probid VARCHAR COLUMNS (31) PATH ' / problem/@id',
Prob def XMLTYPE PATH ' / problem/definitions ")
where PROBLEM_ID = 1;
dbms_output.put_line ($my_var);
end;
Returns null.
Is there a way to switch the setting to extract the function?

You have string literal death of n1 and n2. Note the change to select it.

DECLARE
  my_var VARCHAR2(2000) := NULL;
  n1     NUMBER;
  n2     NUMBER;
BEGIN
  n1 := 1;
  n2 := 2;
  SELECT extract(prob.def, '/Definitions/Definition[' || n1 || ']/@var') || '|' ||
         extract(prob.def, '/Definitions/Definition[' || n2 || ']/@var')
    INTO my_var
    FROM etl_problemxml_stg_t j,
         xmltable('/problem' passing j.xml_column columns probid VARCHAR(31) path '/problem/@id',
                  def xmltype path '/problem/Definitions') prob
   WHERE problem_id = 1;
  dbms_output.put_line(my_var);
END;

Published by: RPuttagunta on December 13, 2010 09:18

Tags: Database

Similar Questions

  • How to pass parameter in the function using the select statement?

    Hello

    I had a problem. I can't pass as parameter to the function by using the select statement. But it can pass as a parameter using the "code". How can I solve this problem?

    For example,.
    Select * from table (SplitFunction ('HS750020, HS750021')) < < < this work.

    but

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) < < < do not work.

    Thank you for trying to help him. Thank you.

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36'))< do="" not="">

    Try like this

    select * from table(select splitfunction(lot_no) from tracer_search_schedule where job_id='36')
    

    Just make sure that your subquery returns only 1 row.

  • Passing parameter to the function header javascript problem

    Hi - I'm trying to pass a string to a javascript function. The javascript function is called an onchange
    event in the attributes of a page element HTML form elements. The call looks like this:

    OnChange = 'lookupObjTypeID ("P3_OBJECTTYPE_NAME")'; (Yes, I want to pass the name of the element, not its value)

    The JavaScript looks like this:

    < script LANGUAGE = "JavaScript" src = "http://www.json.org/json.js" > < / script >
    < script type = "text/javascript" >

    function lookupObjTypeID (source_item_name) {}

    Alert ("running javascript");
    Alert (' name of the Source element: ' | source_item_name);
    }
    < /script >

    The first alert prints the message; the second alert but the source_item_name is null.

    Everything I've seen, this is the right syntax. What's not?

    Thank you
    Carol

    Carol

    Is the in js concatenation operator ' + '. Then

    Alert (' name of the Source element: "+ source_item_name);

    should work.

    CITY

  • Pass the parameter to the functions called from a dll

    Hi all

    I am interfacing a motor controller for PMC - 100 through the Protocol of Performax using labwindows.

    I need to explicitly link the PerformaxCom.dll and call functions with him. I'm calling this function

    BOOL fnPerformaxComOpen (DWORD IN dwDeviceNum, OUT HANDLE * pHandle);

    Faithful:

    If you want to link explicitly, you can consult this article: http://zone.ni.com/devzone/cda/tut/p/id/8503

    It has a code snippet that shows passing two parameters to a DLL function.

    But as for your statement that "I don't know how to pass parameter to him", in the example, you reference, you pass a parameter: it's just a constant string rather than a variable.

  • I have a CC to individuals on the annual plan paid monthly membership. How to pass it to the CC for the teams plan so that I can add my first certificate of employee?

    I have a CC to individuals on the annual plan paid monthly membership. How to pass it to the CC for the teams plan so that I can add my first certificate of employee?

    Hi Alexalloy,

    This should help. Cancel your subscription or membership. Cloud Creative

    See you soon!

    ~ David

  • How to pass arguments to the SQL Script in command prompt

    I don't know about the ' & nom_de_variable "to request a value in the command line.

    But, how can I pass arguments from the command line for the following script to the command - prompt

    Example:

    ex_proc. SQL

    CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
    IS
    v_emp_id Number (38);
    BEGIN

    v_emp_id: = employe_id;

    UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;

    END;
    /


    call_ex_proc. SQL

    Appellant for procedure above:

    BEGIN

    ex_proc (100); -The employee id is 100.

    END;
    /

    Here are the General controls that we use to run the scripts above-

    SQL > @ex_proc.sql

    SQL > @call_ex_proc.sql



    But my requirement is to pass the employee id as an argument in the command line as.
    SQL > @call_ex_proc.sql 100

    Is it possible to pass command line arguments?

    Usually this question start with reading documentation, wouldn't it?

    Solomon Yakobson showed you the method gross and unreadable.

    You will use best

    set = '& 1' '.

    -use & in the rest of the code

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • Marshall plan: how to pass data between the main field and sub-application

    Hello

    I'm trying to load a Flex 3.5 application in Flex 4. In the process, I need to move a strong local typed object from main application to the loaded swf file. And I also have to pass a rope and a bitmap of application sub to the main application. Have an example to show how to pass data in the application domain?

    Thank you

    SW

    Define scaleContent = true, set a breakpoint on SWFLoader.as:doScaleContent and

    see if he thinks there's a swfBridge.

  • Please correct the function map for photo albums in Photos

    Dear Apple people - difficulty please please the function map for photos in photo books. I loved the features of cards in iPhoto, so why go to all the trouble of screwing up so royally in Photos v1.5? A few examples at random: instead of being able to type a place name and have the program to find the place for you, must now click on the + sign, then a red dot appears in a place at random (as in the middle of the Tasman Sea), and we can then move the red dot at the location you want (after first checking a different map to determine the correct location of the place you mean - Port Douglas Australia for example). A colossal waste of time. Or how about this: it takes an hour to put the plan in place so, then closes the program. At the next opening it, found the red dots have all migrated to odd locations around the map, bearing no resemblance to where they were placed at the origin. Once again, a huge waste of time. And it's only two of many examples.

    Please, I beg you, bring back the features of cards in iPhoto!

    1 - Apple isn't here - it is strictly a user to user forum

    2 - person here can fix anything

    3. you can certainly type the names of places with pictures - using Photos (a great place to get help with Photos)

    View and add information about the photos

    To view or change information for the photos, you select one or more photos, and then open the information window.

    • Open the Info window: Double-click a photo to view it, and then click the Info button in the toolbar or press on command I.
    • Add or edit information:
    • Change the following.
      • Title: Enter a name in the title field.
      • Description: In the Description field, type a caption.
      • Favorite: Click the Favorites button to mark the photo as a favorite. Click the button again to deselect.
      • Keywords: Enter the keywords in the keywords field. When you type, Photos suggest keywords that you have used before. Press enter when you have finished a keyword. To remove a keyword, select it and press DELETE.
      • Faces: Click on and type a name to identify a face. Click on several times, and then drag the identifier of the face different faces to identify many faces in a photo.
      • Location: Enter a location in the location field. When you type, Photos suggest places you can choose. To change a location, you can search a different location or change the location by dragging a PIN on the map. To remove location information, delete it or choose Image > location, then choose Remove location or back to the original location. You cannot assign a location if your computer is not connected to the Internet

    4 - If you want to discuss the Photos it is best to post in the forum Photos rather than the abandoned iPhoto product forum - I would ask that this be moved

    5 - If you mean apple use the correct form - http://www.apple.com/feedback/photos.html

    LN

  • Is it possible to try the function "send for Signature" before ordering?

    Is it possible to try the function "send for Signature" before ordering?

    Hi daves.

    I'm sorry for the delay in answering your question. You are welcome to download a free trial of 30 days of Acrobat Pro DC, if you want to see how sending the Signature feature. You can download the trial from this page: Download Adobe Acrobat free trial version | Acrobat Pro DC.

    Best,

    Sara

  • How can I get off the annoying ads for Apple music for good?

    How can I get off the annoying ads for Apple music for good?

    Settings-> music-> see music from Apple (off)

    Does that help?

  • How to disable him drag the text selected for searching the Web?

    How to disable him drag the text selected for searching the Web?

    Hmm, I did not forward. This is a new tab page with nothing to do with what you were dragging?

    I wonder if this might be a feature of one of your extensions. You can see their and disable/remove those that are not essential or unrecognized, here:

    Firefox orange (or the Tools menu) button > addons > Extensions category

    If you disable the extensions, usually a link will appear above at least one of them to restart Firefox. You can complete your work on the tab and click one of the links in the last step.

    If there is no difference, you could test mode without failure of Firefox - which is a standard diagnostic tool in order to avoid interference by extensions (and some custom settings). More info: questions to troubleshoot Firefox in Safe Mode.

    You can restart Firefox in Mode safe help

    Help > restart with disabled modules

    In the dialog box, click on 'Start mode safe' (not Reset)

    Any difference?

  • How to recover or find the network key for a router wireless (Netgear)

    Network wireless adapter NIC Ethernet network device

    How to recover or find the network key for a router wireless (Netgear)

    Hi RaymondKramp,

    ·         What version of Windows is installed on your computer?

    If you have lost the key to network and not connected to the network, then you can reset the router to factory settings wireless.

    If you lost the key network and connected to the network, and then log on to the Web page of the router and get the key.

    For more assistance, you can contact Netgear Support:

    http://support.NETGEAR.com/app/home

    Hope this information helps.

  • How can I re - attach the data files for the programs?

    Original title:

    reconnection of the files

    BONE had to be reinstalled.  All data is saved but lost programs.  Programs now reinstalled, but how can I re - attach the data files for the programs?

    Hello

    You copy the data on your computer (Documents, Photos, etc.) and file extensions should be automatically associated with programs they have written in.

    Otherwise:

    "Changing programs by default by using Set Program Access and defaults of the computer"

    http://Windows.Microsoft.com/en-us/Windows/set-program-access-computer-defaults#1TC=Windows-7

    "How to change file Associations in Windows 7 and Windows 8.

    http://www.7tutorials.com/how-associate-file-type-or-protocol-program

    See you soon.

  • Owner OF THE LICENSE No. [removed-kglad], PREVIOUSLY INSTALLED on OLD PC WHO CRASHED. HOW AND WHERE TO FIND THE NEW DOWNLOAD FOR THIS NEW PC. LICENSE FROM A USER OF MAY 2011.

    Owner OF THE LICENSE No. [removed-kglad], PREVIOUSLY INSTALLED on OLD PC WHO CRASHED. HOW AND WHERE TO FIND THE NEW DOWNLOAD FOR THIS NEW PC. LICENSE FROM A USER OF MAY 2011.

    Available downloadable Setup files:

    Download and installation help links Adobe

    Help download and installation to Prodesigntools links can be found on the most linked pages.  They are essential; especially steps 1, 2 and 3.  If you click on a link that does not have these listed steps, open a second window by using the link to Lightroom 3 to see these "important Instructions".

  • How many computers works with the creative cloud for teams?

    How many computers works with the creative cloud for teams?

    Please see the business FAQ: Help & Support Enterprise

    Guinot

Maybe you are looking for