How pass parameter to function

I have created function name is 'Funsepratecolumvaue'
and I took one parameter, I want to pass this parameter out put of below variable, how can i do
declare @para varchar(500);
set @para='select rawRow from sepratecolumvaue'
I tried like this  
select * from Funsepratecolumvaue (@para)
but directly passed select query

Is this something you are looking for?
Yes, you can with the help of apply clause.
CREATE FUNCTION dbo.fnSplit(
@sInputList VARCHAR(8000) -- List of delimited items
, @sDelimiter VARCHAR(8000) = ' ' -- delimiter that separates items
) RETURNS @List TABLE (item VARCHAR(8000))
BEGIN
DECLARE @sItem VARCHAR(8000)
--declare @sDelimiter varchar(8000) = ' '
WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
BEGIN
SELECT
@sItem=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1))),
@sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+LEN(@sDelimiter),LEN(@sInputList))))
IF LEN(@sItem) > 0
INSERT INTO @List SELECT @sItem
END
IF LEN(@sInputList) > 0
INSERT INTO @List SELECT @sInputList -- Put the last item in
RETURN
END
GO
create table table1
id int,
name char(10),
dept varchar(20))
insert into table1 values(1,'aa','1,2,3,4,5')
insert into table1 values(3,'bb','1,2,3')
select * from table1
OUTER APPLY dbo.fnSplit(dept,',') p
--Prashanth

Similar Messages

  • How to pass parameter in Function by using select statement?

    Hi,
    I got a problem. I cant pass in parameter to function by using select statement. But it can pass in parameter by using 'hardcode' method. How can I solve this problem?
    Eg,
    select * from table (SplitFunction('HS750020,HS750021')) <<< this work.
    but
    select * from table (SplitFunction(select LOT_NO from TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) <<< do not work.
    Thanks for who try to help. Thanks.

    skymonster84 wrote:
    I have try this before. But it not work.here is an example
    create or replace type stringlist as table of varchar2(100)
    create or replace function splitstring(pstring in varchar2) return stringlist
    as
      lstringlist stringlist;
    begin
      select regexp_substr(pstring,'[^,]+',1, level) bulk collect into lstringlist
        from dual
      connect by level <= length(pstring)-length(replace(pstring,','))+1;
      return lstringlist;
    end;
    select * from table(select splitstring('xx,yy,zz') from dual)
    create table t(str varchar2(100))
    insert into t values('x,y,z')
    insert into t values('a,b,c')
    select * from table(select splitstring(str) from t where rownum<2)
    /If you supply multiple values then it will fail.
    select * from table(select splitstring(str) from t)
    /

  • Passing parameter to Function in select clause BIP 11g

    Hi,
    I am developing a dataset where i ahave to pass Parameter to a function which retrives the cursor in BIP 11g
    below is the SQL:
    select cizcompfn(:P_USER_ID) COMPANY_INFO,
    cizinstfn(:P_REPORT_CD, :P_USER_ID) CURRENCY_INFO,
    sysdate AS PRINT_DATE_TIME_INFO,
    cizlballfn(:P_REPORT_CD, :P_USER_ID) LABEL_INFO,
    cipacsvpfn(:P_USER_ID, to_char(:P_FROM_DT,'yyyy-MM-dd') ,
    to_char(:P_TO_DT, 'yyyy-MM-dd')) RETURN_CODE_INFO, rpt_option_val SERVER
    FROM ci_rpt_option where rpt_opt_flg = 'RPSV'
    I have created the 4 parameters :P_USER_ID, :P_REPORT_CD , :P_FROM_DT and :P_TO_DT
    I am not getting the result generated.
    If develop the dataset in BIP 10g, this working fine.
    Please, let me know what needs to changed so that it works in BIP11g.
    Regards,
    Hemanth

    I am getting the result like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <!-- Generated by Oracle BI Publisher 11.1.1.5.0
    -->
    - <DATA_DS>
    <P_TO_DT>2010-01-01T00:00:00.000-05:00</P_TO_DT>
    <P_FROM_DT>2000-01-01T00:00:00.000-05:00</P_FROM_DT>
    <P_REPORT_CD>CI_ACSVPR</P_REPORT_CD>
    <P_USER_ID>CDX</P_USER_ID>
    - <G_1>
    <PRINT_DATE_TIME_INFO>2012-05-11T07:22:57.000-04:00</PRINT_DATE_TIME_INFO>
    <SERVER>http://server-name:port-number</SERVER>
    </G_1>
    </DATA_DS>
    Value for two columns:
    sysdate AS PRINT_DATE_TIME_INFO
    rpt_option_val SERVER
    which are straight forward columns.
    When i pass hardcoded values instaed of parameters I get the XML:
    Below is the SQL:
    select cizcompfn('CDX') COMPANY_INFO, cizinstfn('CI_ACSVPR', 'CDX') CURRENCY_INFO, sysdate AS PRINT_DATE_TIME_INFO,
    cizlballfn('CI_ACSVPR', 'CDX') LABEL_INFO,
    cipacsvpfn('cdx', to_char('05-may-1900') ,to_char( '05-may-2012')) RETURN_CODE_INFO,
    rpt_option_val SERVER from ci_rpt_option where rpt_opt_flg = 'RPSV'
    Edited by: 931007 on May 11, 2012 7:29 AM

  • Passing parameter in function module

    hi friends,
    I have created one function module in which i need to pass PO/SO number from standard EKKO/VBAK tables through the select option parameter S_POSONO. Inside the function module I have a select query which fetches the records from a Z-table which has a field called 'REFERENCE' which is 16-char long. Hence the length mismatches with PO/SO no which is 10-char long. the first 10-char from 'REFERENCE' is PO/SO number, next 3-char is line-item num, and the last three char is schedule item num. It is required to match only first 10-char with the parameter passed i.e, S_POSONO and display only those datas.
    The function module is as follows.....
    Function :
    CALL FUNCTION 'YFIIN_RETRIEVE_SOURCE_DATA'
    EXPORTING
       LT_RANGE_BUKRS          = S_BUKRS[]
       LT_RANGE_DOCNO          = S_POSONO[]
       LT_RANGE_DOCDATE        = S_DATUM[]
       LT_RANGE_CURRENCY       = S_FCURR[]
      TABLES
        IT_TEMEXPOSU            = LT_TEMEXPOSU
    EXCEPTIONS
       INVALID_SELECTION       = 1
       OTHERS                  = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Source code inside function module:
      SELECT * FROM ZFIGL_TEMEXPOSU INTO  TABLE IT_TEMEXPOSU
                                     WHERE   COMPANY_CODE IN LT_RANGE_BUKRS
                                     AND  currency in LT_RANGE_CURRENCY
                                     and  REFERENCE in LT_RANGE_DOCNO
                                     and  doc_date in LT_RANGE_docdate.
    IF SY-SUBRC = 0.
    SELECT COMPANY_CODE ATTRIBUTE_01 REFERENCE CREATION_DATE FOREIGN_CURR                                                               
               FROM TEMT_RAWEXPOS APPENDING CORRESPONDING FIELDS OF
                   TABLE IT_TEMEXPOSU WHERE COMPANY_CODE IN  LT_RANGE_BUKRS
                                     AND REFERENCE in LT_RANGE_DOCNO
                                     AND CREATION_DATE IN  LT_RANGE_DOCDATE
                                     AND FOREIGN_CURR IN LT_RANGE_CURRENCY.
       ENDIF.
    Import Parameter of Function Modules :
    LT_RANGE_BUKRS   - type - BUKRS
    LT_RANGE_DOCNO  - type - EBELN
    LT_RANGE_DOCDATE - type - DOKDATS
    LT_RANGE_CURRENCY - type - WAERS
    please help me to solve this problem..

    Hi Ram Tej,
    Try this.
    First Read all the records without Checking REFERENCE field with LT_RANGE_DOCNO into an internal Tbale.
    Then looping at that internal table delete records from the same internal table where REFERENCE(10) <> LT_RANGE_DOCNO.
    Hope this may help ur requirement.
    Award points if useful.

  • How to pass parameter to function when confirm(Alert.show) closed?

    <![CDATA[
    import mx.controls.*;
    import mx.events.*;
    private function deleteItem(guid:String):void
    Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
    private function alertClicked(event:CloseEvent) {
    if(event.detail == Alert.YES) {
      Alert.show("yes "+guid); //<-- here I want to get guid
    else if (event.detail == Alert.NO){
      Alert.show("no ");
      return;
    ]]>
    Thanks.

    Hi Itambs,
    You can do the following:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="deleteItem('Dummy GUID VALUE')">
    <mx:Script>
      <![CDATA[
       import mx.controls.*;
       import mx.events.*;
       private var myAlert:Alert;
       private function deleteItem(guid:String):void
        myAlert = Alert.show("Are sure you want to delete?", "Confirm Delete", Alert.YES|Alert.NO, this, alertClicked);
        myAlert.data = guid;
        myAlert.height = 150;
                    myAlert.width = 300;
       private function alertClicked(event:CloseEvent):void{
        if(event.detail == Alert.YES) {
           //Alert.show("yes "+guid); //<-- here I want to get guid
           Alert.show("yes "+ myAlert.data);
        else if (event.detail == Alert.NO){
           Alert.show("no ");
           return;
      ]]>
    </mx:Script>
    </mx:Application>
    Note: you can also do this in another way by decalring a global variable guid as ...... private var _guid:String="";
    set _guid = guid; in deleteItem() function and then in alertClicked() function you can access the value as _guid again...which holds the saved value...
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • Passing parameter to function

    Hi All
    I created a custom folder in a business area through discoverer administrator. In this folder one column is returned by
    the funtion.
    I am passing three parameters parameter1, parameter2, parameter3 to this funtion these 3 parameters are used
    in an sql where clause in the function.
    I would like to pass the 4th parameter to the function this parameter is input by the user while running the discoverer
    report from discoverer desktop. Is there any way that I can pass the user parameter value to the function, or any
    alternative solution for this problem.
    Thanks in advance
    Regards
    Ali

    Hi Ali
    You create the function in teh database and then grant the appropriate Discoverer roles or account execute permission over the function. You also need to make sure that the Discoverer Administrator has this privilege too.
    With the function created you bring it into Discoverer. Here's a workflow:
    1. Log in as the administrator to Discoverer Administrator
    2. Select Tools | Register PL/SQL Functions to open the PL/SQL Functions dialog box
    3. With the dialog box open, click the Import button
    4. In the Import PL/SQL Functions box, type the name name of the user that owns the function and then click the Go button - Discoverer will now display a list of the functions.
    5. Highlight the one you want and then click the OK button.
    6. Back in the main box, click the Validate button to make sure Discoverer is able to use it
    7. Once validated, click the OK button to complete the import and close the box
    With the function imported it will now appear in Plus in the Database folder of funxtions when creating a calculation.
    Best wishes
    Michael

  • How pass parameter to report?

    i want to have a report which show the orders of a certain customer
    select order_date , customer_name , order_value from orders
    where customer_id = my_variable
    my variable is the parameter to be passed to the report
    How can i pass the value to the report where parameter name is my_variable
    help
    Best Regards
    Mohamed Hammed

    Hi all,
    Finally i got succeed
    here is a sample code
    and here is how to call a report from a form
    1-Form
    Create Button Action
    Custom
    declare
    input_MEMBERSHIP_NUMBER number;
    l_url varchar2(2000);
    begin
    input_MEMBERSHIP_NUMBER:= p_session.get_value_as_number( p_block_name => 'DEFAULT',
    p_attribute_name => 'A_MEMBERSHIP_NUMBER');
    l_url :=
    'http://servername:7778/pls/portal/PORTAL_DB.SPECIALIZATION_REMOTE.show?p_arg_names=input_MEMBERSHIP_NUMBER&p_arg_values='||input_MEMBERSHIP_NUMBER;
    portal.wwa_app_module.set_target(l_url);
    end;
    2-report
    SQL Used in the report:
    select * from PORTAL_DB.SPECIALIZATION_tab where
    SPECIALZATION_DELETE_DATE IS NULL
    AND MEMBERSHIP_NUMBER = :input_MEMBERSHIP_NUMBER
    order by DEPARTMENT_CODE

  • How pass parameter from Form to Graphics through Report?

    I wrote a Report called by a Form and pass a parameter from the
    Form to the Report, successfully! But I imported a Graphic in
    the Report, and the Graphic could not get the parameter...(the
    parameter in the Report and Graphic should both pass from the
    Form).
    I call the Report by " Run_Product( REPORTS, :V_PRTNAME,
    SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id,NULL); " in the Form.
    and I imported the image from file for the Graphic in the Report.
    Thanks for your help!
    null

    Meilan (guest) wrote:
    : I wrote a Report called by a Form and pass a parameter from the
    : Form to the Report, successfully! But I imported a Graphic in
    : the Report, and the Graphic could not get the parameter...(the
    : parameter in the Report and Graphic should both pass from the
    : Form).
    : I call the Report by " Run_Product( REPORTS, :V_PRTNAME,
    : SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id,NULL); " in the Form.
    : and I imported the image from file for the Graphic in the
    Report.
    : Thanks for your help!
    Meilan,
    This forum is for Headstart related questions and experiences
    only. Please go to metalink.oracle.com to get more information on
    your problem.
    Regards,
    Ton
    null

  • How Pass parameter with Activex Viewer

    Developper enviroment:
    - Crystal Report XI
    - Visual Basic 6.3
    - Access 2007
    Installa library : CRAXDDRT, CrystalActiveXReportViewerLib11_5
    I need to pass some Value to the parameter  field of my reports.
    I use this code that working well to show the report and I need to add the right code to pass some parameter to the Report.
        Dim CRXApplication As CRAXDDRT.Application
        Dim CRXReport As CRAXDDRT.report    
    Private Sub Form_Load()
        Set CRXApplication = CreateObject("CrystalRuntime.Application")
        Set CRXReport = CRXApplication.OpenReport("C:\GR&A_Trend\R1_analisi.rpt", 0)   
        CrystalActiveXReportViewer4.ReportSource = CRXReport      
        CrystalActiveXReportViewer4.ViewReport   
        CrystalActiveXReportViewer4.EnableSearchControl = True   
        CrystalActiveXReportViewer4.Zoom (100)    
    End Sub
    Can You help me  to add the right code to pass some parameter to the Report.
    Thank's
    Regards
    Giovanni Roi

    Giovanni,
    I would love to help you on this however I only work under 2008 environment. Saying that, I am sure if you can re-arrange your coding you will get the desired result.
    Here is the code which I used in my VS2008 to set the parameters under VB.net
    'declaring all the parameter value fields
                Dim crParameterFieldDefinitions As ParameterFieldDefinitions
                Dim crParameterFieldDefinition As ParameterFieldDefinition
                Dim crParameterValues As New ParameterValues
                Dim crParameterDiscreteValue1 As New ParameterDiscreteValue
                Dim crParameterDiscreteValue2 As New ParameterDiscreteValue
                'the two text boxes which will carry the discrete parameter value
                crParameterDiscreteValue1.Value = TextBox1.Text
                crParameterDiscreteValue2.Value = TextBox2.Text
                crParameterFieldDefinitions = _
        cryRpt.DataDefinition.ParameterFields
                'Start code parameter value
                crParameterFieldDefinition = _
           crParameterFieldDefinitions.Item("startcode")
                crParameterValues = crParameterFieldDefinition.CurrentValues
                crParameterValues.Clear()
                crParameterValues.Add(crParameterDiscreteValue1)
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
                'End code parameter value
                crParameterFieldDefinition = _
           crParameterFieldDefinitions.Item("endcode")
                crParameterValues = crParameterFieldDefinition.CurrentValues
                crParameterValues.Clear()
                crParameterValues.Add(crParameterDiscreteValue2)
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    Hope this helps
    Regards
    Jehanzeb

  • Passing Parameter to Function - ORA-00904

    Hi - I wonder if anyone can help with this problem please?
    I have developed a function, which works fine, returning a collection as a table. It takes a single parameter, the numeric userid. I've put a report on the page, and hardcoded the userid during testing:
    SELECT rec_id, period_id, proj_id, proj_name, hrs_last_week, hrs_this_week
    FROM TABLE (SELECT tr_return_user_times(364) AS TR_USERTIMES_TAB
    FROM DUAL)
    This works great, and shows the data perfectly. So the next step, was to set up a variable to hold the userid of the person within the application. I've an application item named F155_USERID. If I display this on the page, I am happy that the value is as expected. However, when I put the variable into the function call, it won't parse:
    SELECT rec_id, period_id, proj_id, proj_name, hrs_last_week, hrs_this_week
    FROM TABLE (SELECT tr_return_user_times(:F155_USERID) AS TR_USERTIMES_TAB FROM DUAL)
    now gets the error:
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing.
    If I switch to use generic columns, and run the debug, the item does substitute ok, (i.e. 0.04: binding: ":F155_USERID"="F155_USERID" value="364")
    but I get
    report error: ORA-00904: "TR_RETURN_USER_TIMES": invalid identifier
    If I run the command in TOAD, and put in the same value (364) when prompted for the variable substitution, again, it works fine. This has to be something really simple, but it's cost me a few hours now - I am tearing my hair out (and at my age there's no guarantee it will grow back). Any help appreciated!

    Found it!
    Denes Kubicek is a god. Found a note on his blog. (http://www.deneskubicek.blogspot.com/)
    The answer is
    v('F155_USERID')

  • Passing parameter to function on stage from symbol

    I have a symbol on the stage: symbol1
    Inside symbol1 I have an image: symbol1_image1
    I have another symbol on the stage: symbol2
    Inside symbol2 I have an image: symbol2_image2
    in composition.ready I have an action on the mouseout for symbol1:
    var theTarget = sym.getComposition().getStage().getSymbol('symbol2').$('symbol2_image2');
    sym.getComposition().getStage().doMouseoutGS(theTarget);
    In composition.ready i have the following function defined
    sym.doMouseout = function (colorTile){
    sym.$(colorTile.show());
    I cannot get this to work and I am not understanding why.
    If I do an alert on the mouseout function for
    alert($(colorTile).attr("id"));
    I get the correct referenc to the element I want to show but it does not actually  happen

    Hi Marlene,
    As I already mentionned in a preceding reply in another of your threads, you should use the event object e that gives you access to the target (e.target), without the need to explicitly build a theTarget variable.
    For example, say you want to factorize in a symbol (stage) function the rollover behavior shared by a certain number of buttons :
    • btn<i>.mouseover
    sym.getComposition().getStage().globalFunction( e);
    • document.compositionReady
    sym.globalFunction = function( eBtn)
      console.log( eBtn.target.getAttribute(“id“));
    Then, using Firebug or Chrome dev. tools, you'll see in the console the id of each of the buttons you hover over.
    Gil

  • How pass parameter to a Page

    I have created link (item style : staticStyledText and CSS Class : OraLinkText).
    I add destination Uri like
    OA.jsp?page=/oracle/apps/...../webui/xxxPG&partyNumber={@PartyId}&partyName={@PartyName}&retainAM=N
    when i am checking value in New Page , I am not able to get values
    What may reason behind it.
    What are other ways to pass parameters?

    Getparameter is straight forward way to get paramter on a new page processReuest()
    String mypartyname = pageContext.getParameter("partyname");
    Other approch is , use the PPR on the specifi item , such as icon or button or ur message style tex by setting 2 things
    1) Set action type = fireAction
    2) Set the Parameters at this event , which you can get in processFormRequest()
    as show below.
    if ("newPageNavigationEvent".equals(pageContext.getParameter(EVENT_PARAM)))
         String p1 = pageContext.getParameter("partyname");
    String p2 = pageContext.getParameter("partyid");
    HashMap pageParams = new HashMap(2);
    pageParams.put("partyNumber",p1 );
    pageParams.put("partyName",p2 );
    pageContext.setForwardURL("OA.jsp?page=/oracle/apps/...../webui/xxxPG"
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    pageParams,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
    OAWebBeanConstants.IGNORE_MESSAGES);
    )

  • How to call Plsql function in discoverer

    Hello,
    Can anyone tell me how to call plsql fuunction in Oracle Business Intelligence Desktop Discoverer?
    what i was doing here is i am able to register my function in Administration but i dont know when i need to make call and where i need to pass parameters to make call that function.
    its lil urgent, can any of you guys send me the instructions step by step
    Thanks in advance!!
    sid

    Thanks for your reply Michael,some how i found that make call from calculation , but the problem here is i was not able to pass parameter thru function.please find the scenario below,
    case(1) i have function without parameters, it does some DML operations inside that and it is working fine.when i refresh i see tables getting populated.
    case(2)I have another function as shown below with parameters(input) but i was getting error (One of The function arguments has an incorrect datatype:POST_SAVE_DOCUMENT)
    my function is like this:
    create or replace function POST_SAVE_DOCUMENT
    (P_WORKBOOKOWNER in VARCHAR2,
    P_WORKBOOK in VARCHAR2,
    P_WORKSHEET in VARCHAR2,
    P_SEQUENCE in number,
    P_SQL_SEGMENT in VARCHAR2
    return number AS
    BEGIN
    delete from my_sql;
    insert into my_sql
    ( WORKBOOKOWNER,
    WORKBOOK,
    WORKSHEET,
    SEG_SEQUENCE,
    SQL_SEGMENT)
    VALUES ( P_WORKBOOKOWNER,
    P_WORKBOOK,
    P_WORKSHEET,
    P_SEQUENCE,
    P_SQL_SEGMENT
    return 1;
    end;
    i dont see anything wrong here with in this function, but some how i have a problem with parameter.
    Can you give some idea or solution to get rid of this problem.
    Finally ..i did not see anything under item radio button (The recommended way now is to click the Items radio button, find an item that you want to pass to a parameter, then on the right-hand side highlight the placeholder for the parameter, then finally you click the Paste button. You repeat this for all the parameters and then click OK to finish the calculation.
    Thanks in adavance!!
    Thanks
    S!D
    Edited by: user12861418 on Apr 28, 2010 2:01 PM

  • How to pass parameter into extract function (for XMLTYPE)

    I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
    Query
    SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
    FROM PROBLEMXML j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    returns exactly what I want a;m.
    But
    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;
    returns NULL.
    Is there is a way to pass parameter into extract function?

    I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
    For example :
    SQL> WITH etl_problemxml_stg_t AS (
      2   SELECT 1 problem_id,
      3  xmltype('<problem id="1">
      4   <Definitions>
      5    <Definition var="var1"></Definition>
      6    <Definition var="var2"></Definition>
      7    <Definition var="var3"></Definition>
      8   </Definitions>
      9  </problem>') xml_column
    10   FROM dual
    11  )
    12  SELECT j.problem_id,
    13         prob.probid,
    14         prob.def
    15  FROM etl_problemxml_stg_t j,
    16       XMLTable(
    17        'for $i in /problem
    18         return element r
    19         {
    20          $i/@id,
    21          element d { string-join($i/Definitions/Definition/@var, ";") }
    22         }'
    23        passing j.xml_column
    24        columns
    25         probid varchar2(30)  path '@id',
    26         def    varchar2(100) path 'd'
    27       ) prob
    28  ;
    PROBLEM_ID PROBID               DEF
             1 1                    var1;var2;var3

  • Passing parameter values to powershell function from batch file

    Hello ,
       I haven't used powershell for a while and getting back to using it. I have a function and I want to figure out how to pass the parameter values to the function through batch file.
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    <#
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_011.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    #>
    The above code seems to be work when I call it. But when I try to call that script and try to pass the parameter values, I am doing something wrong but can't figure out what.
    powershell.exe -command " &{"C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"}"
    Write-Host "ReturnCode : $returncode"
    $file = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    powershell.exe -file "C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile $datafile
    Somehow the I can't get the datafile parameter value being passed to the function. Your help would be much appreciated.
    I90Runner

    I am not sure about calling a function in a script like how you want to. Also I see you are setting the values of the parameters, this is not needed unless you want default values if nothing is passed. The values for the parameters will be passed via the
    batch file. So for me the easiest way is as indicated.
    param
    [string]$DataFile
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    Write-Host "Return Code: $(Check-FileExists $DataFile)"
    Then you create a batch file that has
    start powershell.exe
    -ExecutionPolicy
    RemoteSigned -Command
    "& {<PathToScript>\MyScript.ps1 -DataFile 'C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile.txt'}"
    Double click the batch file, and it should open a powershell console, load your script and pass it the path specified, which then the script runs it and gives you your output
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

Maybe you are looking for

  • How to fix the iphone 4s if it is the wrong carrier iphone 4s?

    Just wondering if anyone has had this problem and how to fix it.   Lets see in October 2012 I bought a brand new Iphone 4s.   I had it less than a week when I sent it to Apple because it had already been updated to IOS 6 without my knowledge and the

  • TS3408 getting "error 503" when trying to access a particular site.

    says "error 503 : service temporarily unavailable" when I try to access a particular site, if I use phone, access is ok. Thanks in advance

  • Installation error at Update database statistics

    Hi, During DB installation at Update database statistics Installation error. Error shows that MTU- 03010 Execution of the command "/sapmnt/QMS/exe/brconnect   '-u' '/' '-c' '-f' 'crsyn -o 'SAPQMS' finished with status TST_ERROR brconnect.log error /u

  • Indesign weird spacing in justification..

    Can't figure out what is causing these strange spaces in my justified type.. the lines that are turning over should NOT BE and if they were flowing correctly those odd spaces would adjust.. something is making lines turn over WAY out of wack.. I can'

  • How to uninstall OS update

    i would like to know if i can uninstall the latest update for mac Os, because my printer stop working after update.