Order by dynamic variable

Hello,
I am trying to sort my query based on a dynamic variable p_sorton in the cursor as follows:
function getMarketView2(
p_event_id in ex_event.event_id%type,
p_fromrow in integer,
p_torow in integer,
p_appTZ in char,
p_calcTZ in char,
p_sorton in varchar2) return varchar2 as
type t_ticket_trade is ref cursor return ex_ticket_trade%rowtype;
v_return varchar2(32767);
v_return_integer integer;
v_String varchar2(32767);
v_ex_ticket_trade_obj ex_ticket_trade_obj;
v_rowcount integer:=0;
v_rowtotal integer:=0;
v_done boolean:=false;
v_sysdate date:=NEW_TIME(SYSDATE,trim(p_appTZ),trim(p_calcTZ));
cursor cur_ticket_trade_event_open (p_event_id in ex_event.event_id%type, v_sysdate in date) is
select "TICKET_TRADE_ID","SELLER_ACCESS_ID","CREATE_DATETIME","MODIFY_DATETIME","LASTMODIFY_BY",
"BUYER_ACCESS_ID","OPEN_TRADE_DATE","CLOSE_TRADE_DATE","TICKET_SUITE_CODE","TICKET_DATETIME",
"TICKET_TIMEZONE","TICKET_EVENT_ID","TICKET_TYPE","TICKET_SEAT_TYPE","TICKET_OPPONENT",
"TICKET_TOTAL_SEAT","TICKET_PRICE","TICKET_PRICE_EXT","START_BID_DATE","OPEN_BID_PRICE",
"CURRENT_BID_COUNT","CURRENT_HIGH_BID","CURRENT_LAST_BID_DATETIME","CURRENT_BID_INCREMENT_BY","TICKET_TRANSACTION_DATE",
"TICKET_TRADE_STATUS" from ex_ticket_trade
where ex_ticket_trade.TICKET_EVENT_ID = p_event_id
and (ex_ticket_trade.ticket_datetime > v_sysdate)
and (ex_ticket_trade.ticket_trade_status in ('F','A','AB'))
and (ex_ticket_trade.ticket_suite_code='N' OR ex_ticket_trade.ticket_suite_code='Y')
order by p_sorton desc;
--ex_ticket_trade.ticket_datetime desc;
........then comes the rest of the code........
This code compiles fine but does not use the value passed in the param p_sorton in the order by clause.
the same code works fine when hardcoded to "ex_ticket_trade.ticket_datetime"
No idea where I may be going wrong?
Also can I do anything like ORDER BY v1 v2
where v1 specifies columns to sort on and v2 asc/desc, coz that's what I really need to do?
Pls help ...
Thanks,
Karuna

Hi,
Thanks for the reply ... I tried the same but due to my basic knowledge of pl-sql, I'm running into some other problem.
================================================
CREATE OR REPLACE FUNCTION testMarketView(p_event_id in ex_event.event_id%type,
p_fromrow in integer,p_torow in integer,
p_appTZ in char, p_calcTZ in char, p_sorton in varchar2
               ) return varchar2 as
type t_ticket_trade is ref cursor return ex_ticket_trade%rowtype;
     v_return varchar2(32767);
     v_return_integer integer;
     v_String varchar2(32767);
     v_ex_ticket_trade_obj ex_ticket_trade_obj;
     v_rowcount integer:=0;
     v_rowtotal integer:=0;
     v_done boolean:=false;
     v_sysdate date:=NEW_TIME(SYSDATE,trim(p_appTZ),trim(p_calcTZ));
     TYPE t_ticket_trade_event IS REF CURSOR;
     cur_ticket_trade_event t_ticket_trade_event;
     v_dynQuery VARCHAR2(1000);
     cursor cur_event_seat_section_row (p_ticket_trade in ex_event_seat_inv.ticket_trade_id%type) is
     select distinct event_seat_section, event_seat_row
     from ex_event_seat_inv
     where ticket_trade_id = p_ticket_trade;
     type t_event_seat_section_row is ref cursor return cur_event_seat_section_row%rowtype;
/*v_section varchar2(32767);
     v_section_row varchar2(32767);
     the 26 variables that belong to table ex_ticket_trade-----------
     v_ticket_transaction_date date;
     v_ticket_trade_status varchar2(10);*/
begin
v_dynQuery := 'select
"TICKET_TRADE_ID","SELLER_ACCESS_ID","CREATE_DATETIME","MODIFY_DATETIME","LASTMODIFY_BY",
"BUYER_ACCESS_ID","OPEN_TRADE_DATE","CLOSE_TRADE_DATE","TICKET_SUITE_CODE","TICKET_DATETIME",
"TICKET_TIMEZONE","TICKET_EVENT_ID","TICKET_TYPE","TICKET_SEAT_TYPE","TICKET_OPPONENT",
"TICKET_TOTAL_SEAT","TICKET_PRICE","TICKET_PRICE_EXT","START_BID_DATE",
"OPEN_BID_PRICE","CURRENT_BID_COUNT","CURRENT_HIGH_BID",
"CURRENT_LAST_BID_DATETIME","CURRENT_BID_INCREMENT_BY",
"TICKET_TRANSACTION_DATE","TICKET_TRADE_STATUS"
from ex_ticket_trade where
ex_ticket_trade.TICKET_EVENT_ID = ' || p_event_id || ' and (ex_ticket_trade.ticket_datetime > '|| v_sysdate||')
and (ex_ticket_trade.ticket_trade_status in ('||'''F'''||','||'''A'''||','||'''AB'''||'))
and (ex_ticket_trade.ticket_suite_code='||'''N'''||' OR ex_ticket_trade.ticket_suite_code='||'''Y'''||')
order by '|| p_sorton ||'desc ' ;
select count(*) into v_rowtotal
from ex_ticket_trade
where
ex_ticket_trade.TICKET_EVENT_ID = p_event_id
and (ex_ticket_trade.ticket_datetime > v_sysdate)
and (ex_ticket_trade.ticket_trade_status in ('F','A','AB'))
and (ex_ticket_trade.ticket_suite_code='N' OR ex_ticket_trade.ticket_suite_code='Y')
order by ex_ticket_trade.ticket_datetime asc;
v_ex_ticket_trade_obj:=ex_ticket_trade_tabobj.initialize;
v_rowcount:=1;
OPEN cur_ticket_trade_event FOR v_dynQuery;
     LOOP
     FETCH cur_ticket_trade_event INTO t_ticket_trade;
/*     -- THIS IS WHAT I HAVE TO DEAL WITH IF I CAN"T
     --PUT THE RESULTS OF THE CURSOR in t_ticket_trade
     v_ticket_trade_id , v_seller_access_id , v_create_datetime, v_modify_datetime , v_lastmodify_by ,
     v_buyer_access_id, v_open_trade_date, v_close_trade_date, v_ticket_suite_code, v_ticket_datetime,
     v_ticket_timezone, v_ticket_event_id , v_ticket_type, v_ticket_seat_type,     v_ticket_opponent,
     v_ticket_total_seat, v_ticket_price ,     v_ticket_price_ext , v_start_bid_date, v_open_bid_price ,
     v_current_bid_count , v_current_high_bid , v_current_last_bid_datetime , v_current_bid_increment_by ,
     v_ticket_transaction_date , v_ticket_trade_status ;
if (t_ticket_trade.TICKET_SEAT_TYPE is null) then
for t_event_seat_section_row in cur_event_seat_section_row(t_ticket_trade.ticket_trade_id) loop
if (t_event_seat_section_row.event_seat_section is not null) then
v_section := t_event_seat_section_row.event_seat_section;
BEGIN
select alt_txt into v_parking_desc from ex_alt_txt
where event_id = p_event_id
and alt_txt_type = 'PARKING_DESC'
and original_txt = v_section;
t_ticket_trade.TICKET_SEAT_TYPE := v_parking_desc;
EXCEPTION
WHEN no_data_found THEN
v_section_row := 'Sec. ' || v_section;
if (t_event_seat_section_row.event_seat_row is not null) then
v_section_row := v_section_row || ', Row ' || t_event_seat_section_row.event_seat_row;
end if;
v_section_row := substr(v_section_row, 1, 30);
t_ticket_trade.TICKET_SEAT_TYPE := v_section_row;
END;
exit;
end if;
end loop;
end if;
if ((v_rowcount >= p_fromrow) and (v_rowcount <= p_torow)) then
-- p_ex_ticket_trade => t_ticket_trade
     -- THIS IS WHAT I CAN'T DO in the next line IF I get the results of the cursor in seperate variables
     v_ex_ticket_trade_obj:=ex_ticket_trade_tabobj.maprowtoobj(p_ex_ticket_trade => t_ticket_trade);
v_string:=v_string||v_ex_ticket_trade_obj.todatastring;
end if;
if (v_rowcount>=p_torow) then
exit;
end if;
v_section := null;
v_section_row := null;
v_parking_desc := null;
v_rowcount:=v_rowcount+1;
end loop;
v_prefix:='1' || v_delimiter || v_rowtotal || v_terminator;
v_return:= v_prefix || v_ex_ticket_trade_obj.tometadata||v_string;
return v_return;
end;
===========================================
I keep running into one error:
PLS-00403: expression 'T_TICKET_TRADE' cannot be used as an INTO-target of a SELECT/FETCH statement
How can I get each row of the cursor either as an object or as 'T_TICKET_TRADE' ?
Thanks,
Karuna

Similar Messages

  • Dynamic variable names and invalid_character_err

    I'm neither an expert at structure notation nor dynamic
    variable naming conventions and would appreciate any help with the
    following. Thanks!
    This code works fine.
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <cfinput name="static_form_name" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    The following code results in the following error:
    "ORG.W3C.DOM.DOMEXCEPTION ERROR. Message: INVALID_CHARACTER_ERR: An
    invalid or illegal XML character is specified." The only change is
    in the "name" attribute of the <cfinput> tag:
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <!--- Change value of name attribute from
    "static_form_name" to "product[idx].product_nm" --->
    <cfinput name="product[idx].product_nm" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    Pam Grieger
    [email protected]

    Thanks for the info. Knowing what WON’T work is
    helpful!
    Here’s what I’m trying to do. I’m rewriting
    one of my apps, switching out conventional HTML form controls for
    <cfform> controls in Flash format. Many of the existing forms
    in my app are for updating data contained in a central database.
    When such a form is rendered to the screen, each form control is
    pre-populated with existing data. All form controls are named
    dynamically based upon the unique ID of the record being updated.
    Here’s a streamlined but typical example:
    <!--- User selected projects 14, 15, 16, and 17 for
    update. Get existing project data. --->
    <cfquery name="get_project_detail"
    datasource="#application.DataSource#">
    SELECT project_oid_nbr, project_nm
    FROM project_table
    WHERE project_oid_nbr IN (14,15,16,17)
    ORDER BY project_oid_nbr
    </cfquery>
    <!--- Initialize the project_nm form control. Form names
    are dynamic, based upon get_project_detail.project_oid_nbr. --->
    <cfloop query="get_project_detail">
    <cfparam name="form.project_nm_#project_oid_nbr#"
    default="#get_project_detail.project_nm#">
    </cfloop>
    <!--- Create HTML form control. --->
    <table>
    <cfloop query="get_project_detail">
    <tr>
    <td>
    <cfoutput>
    Project #project_oid_nbr#:
    <input type="text" name="project_nm_#project_oid_nbr#"
    value="#Evaluate("form.project_nm_#project_oid_nbr#")#">
    </cfoutput>
    </td>
    </tr>
    </cfloop>
    </table>
    This has been working just fine. However, I’m wondering
    if using the Evaluate() function is the most efficient way to go.
    Therefore I wanted to use structure notation to avoid the
    Evaluate() function, but as mentioned in my original post, this
    naming convention won’t work with <cfform> tags.
    Any suggestions as to the most efficient way to get the same
    result while still using <cfform> tags? Thanks so much!

  • Dynamic variable for 0CALDAY

    Hi all, this is my scenario:
    I've created a query with input variable for characteristic Year/Month (0CALMONTH), in columns i added a key figure and in rows i added the characteristic 0CALDAY. The result looks someting like this:
    Varibale entry: 09.2006
    Result table:
    <b>
    0CALDAY      | KYF</b>
    01.09.2006 | 1,000
    02.09.2006 | 2,000
    03.09.2006 | 1,500
    30.09.2006 | 2,100
    31.09.2006 | 2,350
    Now, what i need is to add a column that shows the value of the previous day, so the result should be:
    Varibale entry: 09.2006
    Result table:
    <b>
    0CALDAY      | KYF      | Previous Day KYF</b>
    01.09.2006 | 1,000  | -
    02.09.2006 | 2,000  | 1,000
    03.09.2006 | 1,500  | 2,000
    30.09.2006 | 2,100  | (value for 29.09.2006)
    31.09.2006 | 2,350  | 2,350
    I guess offsets will be the solution, but i need a variable (dynamic variable) to read the current day (0CALDAY) in the report... anyone knows how to do this? a customer exit can solve it (which code)? Please advice.
    Thank you.

    Thank you KJ for your answer, but unfortunatelly my knowledge in ABAP is very limited, ¿Do you happen to have an example so i can see how to customize it in order to read values from characteristic 0CALDAY?

  • SE61 - Dynamic Variable

    All,
    I had created a Dialog text using transaction SE61 that contains a dynamic variable
    Data Sheet not printed for Sales Order Number &WA_OUTPUT-VBELV&
    This diagonose object i am calling in function module POPUP_TO_CONFORM
    like
      call function 'POPUP_TO_CONFIRM'
        exporting
          titlebar              = text-t01
          diagnose_object       = p_dobject     "<<==== Here
    But the issue while calling the function module i am not getting the dynamic variable &WA_OUTPUT-VBELV&
    in the display is it showing like the following
    Data Sheet not printed for Sales Order
    Number &WA_OUTPUT-VBELV&   "<=Here i need in display the sales order to be displayed

    Hi
    Yes I've understood what you mean
    When I've spoken about sapscript and driven program, I means the sapscript and program manage the long text (dialog text created by SE61).
    In your situation those elements are not used, because the text is directly shown on popup, so the variable inserted in the text (it's usually defined in the main program) has to assigned the PARAMETER table ( I thought you defined the variable in the program calling popup).
    So try this:
    PARAMETER-PARAM = WA_OUTPUT-VBELV.
    PARAMETER-VALUE = <document number>.
    It works
    Max

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • AS2 syntax and dynamic variable names

    Hi all,
    Trying to learn AS2 and hoping someone can help me by
    explaining the problems with the following sample code and what
    would be needed to make it work (i.e. to create dynamic variables
    and movie clips from an array).
    Thanks for your time!

    kglad: Thanks for the super-quick and tremendously helpful
    response! Much appreciated!
    A couple of quick follow-up questions:
    kglad wrote that "createEmptyMovieClip() returns a reference
    to the created movieclip".
    How would I use/access this reference?
    Also, in the updated code below, I have two issues:
    1. rolling over a movie clip yields "this is button
    undefined" rather than "this is button a" for example; and
    2. clicking on a movie clip outputs the result of the trace
    command for all four clips (in reverse order) rather than just the
    one clicked.
    Any insights into what I need to do differently? Thanks
    again!

  • Binding dynamic variable in XQuery doesn't work: ORA-00932

    I have a table with several columns. One of those columns is a XMLType.
    My goal is to have a query which selects rows from the table of which the XML column matches certain criteria.
    I'm trying following example (JDBC) : http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#insertedID11
    First, I created my own query, which looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, "someValue")] return "true"' passing t.xmlColumn)This works as expected. Next, as done in the example, I'm trying to replace the "someValue" with a dynamic variable.
    Query then looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, $val)] return "true"' passing t.xmlColumn, :1 as "val")This does not seem to work, neither in SQLDeveloper nor in java.
    I always get the :
    java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CHAR(SQLDeveloper just gives ORA-00932)
    When I put $val between quotes (so "$val") then I get no error, but then I get no results either.
    I think it will not replace $val in that case but just use it as a literal, so thats not what I want
    I also tried to remove "contains" xpath and use the exact same example as on the oracle page
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement/Key = $val return "true"' passing t.xmlColumn, :1 as "val")But this doens't help either.
    I'm clueless about this, so any help would be appreciated
    Edited by: user5893566 on Nov 29, 2008 6:24 AM

    Ok, I tested it using the latest enterprise edition (11g) and there it works as expected.
    However, on 10.2.0.1.0 and 10.2.0.3.0 it gives this error.
    Is this a bug which has been fixed or should I do something special on 10g ?
    I installed all of these as normal without any special settings, created the tables and ran the query...

  • How do I use a dynamic variable from a prolog script?

    I have my test broken in to three scripts, a login, an update, and a logout. There is a dynamic variable, SERVICE_VIRTUAL_CLIENT, from the login script that I need to use in the update script, but I can't figure out how to do it. Any help would be appreciated.
    Edit: I forgot to mention that the login script is only run in the prolog portion of the UDP.
    Scott
    Message was edited by: scottmorgan

    Scott,
    You would do this the same way you would in a stand-alone script. Create the variable pattern in the login in script and name the variable. Save the login script and open the other script and select the parameter where you need the value. Set the parameter value to {{variableNameFromLogin}} (Variables are transferred from one script to the next in a UDP).
    I hope this makes sense

  • Dynamic variable Time for Select

    Hi,
    I try to develop some scripts but always I have the same problem , when I try to put in a Select instruction the variable Time, it doesn´t work correctly (for example):
    *SELECT(%example%,"ID","TIME","[ID]='%TIME_SET%' ")
    It doesn´t read correctly the variable Time_Set.
    Have you got any idea to try to do selects using dynamic variable?
    Thanks for all.

    Hi,
    Dynamic variables like %TIME_SET% do not interact very well with the compiled default logic (LGX files) when it is run after a data send. If you look at the Default.LGX file, you will notice that your *SELECT statement does not appear there because that *SELECT statement has already been compiled. That is why the logic works when it is run via the debugger (because the LGF file is getting executed at run time) and it does not work when it is run via a data send (because the LGX is being executed).
    What you will need to do is:
    1. Create a another logic file (for example: Calculation1.LGF) and copy the text from the Default.LGF to this new logic file.
    2.  Place the following text in the Default.LGF file:
    *RUNLOGIC
    *LOGIC=Calculation1.LGF
    *ENDRUNLOGIC
    3. Validate and save the Default.LGF file
    Now try running the logic after a data send and see if that works.
    Good luck,
    John

  • IMPORT statement with dynamic variable

    Friends, Need Help!!!!!!!
    Im trying IMPORT variable contents from a cluster table VARI. I can do a IMPORT without issues when I use exact name of the variable but I have issues with dynamic variable selection. Pls see code below.
    loop at objects.
       assign objects-name to <fs>.
       IMPORT <fs> to tmp_var from database vari(va) id st_key.
    endloop.
    I do not get any value to tmp_var.  Need help!
    thanks
    Bhaskar

    Try this.
    loop at objects.
    IMPORT (objects-name) to tmp_var from database vari(va) id st_key.
    endloop.
    Does it work?
    Regards,
    RIch Heilman

  • Dynamic Variable In a Type Definition

    Can someone tell me how to define and use a dynamic variable, which resides in a Type Definition.  I.E...
    Type: beg of type1,
            field 1 type c,
            field 2 <---this dynamic
            field 3 type c.
          end of type1.
    Can this be done in Netweaver 2004.  And if so, can you show me how?
    Thanks for your time.
    Kind Regards,
    Jason

    Don't think it is available now, but I do believe they are working on this for a future release.
    Regards,
    Rich Heilman

  • Dynamic variable value based on a value from xml

    I have a invoice template and it is for 4 different companies in my organization. Based on the organization I need to have a different value for a variable that adds blank lines to the end of the invoice. Is there anyway to assign a value to variable based on the value of a xml tag.
    Thanks

    I should have explained better before. I have one invoice template and we want to keep it one template for all companies. Each invoice is run individually, each companies footer is different, I am calling multiple headers and footers based on each company. Since the headers and footers are different I need to be able to add different amounts of lines and the end of each invoice depending on that company. I have accounted for the page break in my logic based on the amount lines the page is long. I just need a dynamic variable that I can assign different values on the fly.
    Thanks

  • Dynamic variable and/or XML LazyLoader HELP

    I am loading images via xml lazyloader into my air app
    I need var b to be "img" +  item.id dynamically
    any ideas???
    for each (var item : LoadingItem in lazy.items)
                        var b : Bitmap = lazy.getBitmap(item.id);
                        addChild(b);
    If you dont know the lazyloader code then can you please explain how to create a dynamic variable for a bitmap???

    so i should set type here
    var img:bitmap = {}
    then create the variable like this in my for statement?
    img[this[item.id]] = lazy.getBitmap(item.id);
    lets say item was 1,2,3
    Then
    img[1]
    img[2]
    img[3]
    would be able to hold a different bitmap
    thanks in advanced

  • Creating dynamic variable names

    I know there has got to a way to do this but I am not finding anything on google. I want to create a dynamic variable name like name + i so when your in a loop the names come out name1, name2 and so on till however many you want. I have tried
    int name + i = 3;
    int name[i] = 3; // which obviously won't but I had to try
    int name{i} = 3;and I am out of ideas. Thanks for all your help.

    I'd suggest using variables named j or x when posting code which uses them as array indexes.
    [i] - is for italics formatting
    [u] - is for underlined formatting
    [code] is for class Example { ... } code formatting
    etc.

  • Dynamic Variable Names

    Okay, I just need to figure out how to make dynamic variable
    names. In this case, I have a loop, and inside the loop I need to
    create a new array for every iteration of the loop. Something like
    <cfloop from="0" to="10" index="i">
    <cfset LoopArray#i# = Some Value>
    </cfloop>
    But that doesn't work. How can you make dynamic variable
    named? I think it's probably something to do with evaluate or DE,
    but I don't know how to use them, and the livedocs make no sense to
    me. Thanks!

    On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
    > Thank you both for your replied, I did manage to find a
    solution (the same one
    > posted by JR "Bob" Dobbs). Pretty much just looks
    like...
    >
    >
    > <cfloop from="1" to="3" index="i">
    > <cfset LinkResults["#i#"][1] = "Player 1's Move
    ID">
    > <cfset LinkResults["#i#"][2] = "Player 2's Move
    ID">
    > <cfset LinkResults["#i#"][3] = "Damage to player
    1">
    > <cfset LinkResults["#i#"][4] = "Damage to player
    2">
    > </cfloop>
    From your values, you don't want a two-dimensional array
    (which although
    you're actually building LinkResults as a struct, with the
    sequential
    numeric keys, it's basically an array), you want an array of
    structs, eg:
    LinkResults
    .player1.moveId
    LinkResults.player1.damage
    What is "i" actually counting through? IE: from 1-3 things...
    which are...
    what?
    Adam

Maybe you are looking for