Dynamic variable declaration
Hi
I am writing a procedure in which i get the schema name only as input parameter at run time.
for e.g.:
v_id sys.dba_users.username%type;
In the above datatype declaration, SYS is the schema name, dba_users is the table name and username is the column.
What if i do not know the schema name up front, is there a way for me to have dynamic declaration?
p_schema VARCHAR2(30) := 'SYS';
v_id dba_users.username%type; -- how can i associate this with p_schema
Is it even possible?
The bigger picture is this. The same set of tables is copied to new schema once every few months. The tables data structure does not change except for the schema it belongs to. So i have to write a code which will accept the schema name as input parameter and retrieve data from the right tables.
My question is if there is a way to dynamically specify a schema while declaring variables.
how can i get the equivalent of v_id sys.dba_users.username%type if schema name 'SYS' is not known upfront.
If i get to to schema name 'SYS' at run time like below:
p_schema VARCHAR2(30) := 'SYS';
v_id dba_users.username%type; -- how can i associate this with p_schema
If dynamic declaration is not at all possible, i can always declare my variables as follows:
v_id VARCHAR2(30);
Thanks everyone for your answers though.
Similar Messages
-
Hi experts,
How can i declare Dynamic variable under loop,
I have Data from CABN Table with Char Name /Data type/Length.
Is there any function module or method where i provide the parameters for declaration.
thanks.DATA r_elemdescr TYPE REF TO cl_abap_elemdescr.
r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( 'DATA_ELEMENT_HERE' ).
DATA r_field TYPE REF TO data.
FIELD-SYMBOLS <field> TYPE ANY.
CREATE DATA r_field TYPE HANDLE r_elemdescr.
ASSIGN r_field->* TO <field>.
<field> = .....
"now <field> is your dynamic field value
Regards
Marcin -
Dynamic variable declaration in java program
declaring a variable with the name i.e. contained as a value of other variable.
say String varname = new String("Name");
now how to declare a variable called Name with some datatype........using varname.............
hope it is not very confusing........You can't do it. There should be no reason to do it either.
If you want to store values against particular names, use a Map e.g. HashMap. -
Variable declaration in BEx - Business scenario's
Hi,
I need some documents about all kind of variable declaration with some example business scenarios in MM, FI-CO modules.
will assign you a reasonable points
Regards,
Pooja.SHi Pooja,
The processing type of a variable may be varies from business requirement.
In general we will use the processing type:
Replacement Path : If you specify a variable as a characteristic value, you do not have to specify a text for the characteristic value right away. Instead, you can fill the text field dynamically and specifically for the characteristic that you use for the variable when you execute the query. To do this, define a text variable with automatic replacement.
[http://help.sap.com/saphelp_nw70/helpdata/EN/bd/589b3c494d8e15e10000000a114084/content.htm]
Authorisations: If the user belongs to Asia PAciffic region and he must see only details of his region then we can create a variable Region vt Processing type Authorisations so that he vl able to see only that region's data.
[http://help.sap.com/saphelp_nw70/helpdata/EN/44/599b3c494d8e15e10000000a114084/content.htm]
SAP EXIT: If you want to define a query that only ever displays the data from the current month, drag the delivered variable current month (technical name 0CMONTH) for the characteristic calendar year/month (technical name 0CMONTH) into the query filter.
[http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a5702e09411d2acb90000e829fbfe/content.htm]
Customer Exit: You want to use one characteristic value to calculate a second characteristic value. The InfoProvider only contains the calendar day. However, you now also want to display the cumulated value for the relevant period (beginning with the first day of a quarter) in a query.
For the first day of the quarter, use a variable with customer exit processing. If you now enter the current calendar day (for example, 06/19/2000), a start date of 06/01/2000 appears in the customer exit, and the cumulated value of this period can be displayed.
[http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a56f5e09411d2acb90000e829fbfe/content.htm]
I hope this helps you. -
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 -
How to move a dynamic variable to a FIELD-SYMBOL
Hello:
i would like to ask a favor i have been trying to move a dynamic variable to a FIELD-SYMBOL but, when i compile the programm it send a error message that say 'error with assign'.
The FS is declared like this
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE, <dyn_wa>.
and then there is a PERFORM that send a dynamic varible and then this variable is asigned to the <dyn_table> and after of this one variable is created like this CREATE DATA wa_dynamic LIKE LINE OF <dyn_table>.
and finalilly there is a sentences where i trying to send the wa_dynamic to the <dyn_wa>.
here is where the error appear.
if you have any tips for this problem i will appreciate.
thanks a lot
Definition of FS
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE, <dyn_wa>.
PERFORM
Create dynamic internal table and Assign it to Field Symbol
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = it_dynamic.
ASSIGN it_dynamic->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA wa_dynamic LIKE LINE OF <dyn_table>.
ASSIGN wa_dynamic->* TO <dyn_wa>. "HERE IS THE PROBLEMHow is wa_dynamic defined?
data: wa_dynamic type ref to data.
Regards,
Rich Heilman -
Using a static variable declared in an applet in another class
Hi guys,
I created an applet and i want to use one of the static variables declared in teh applet class in another class i have. however i get an error when i try to do that...
in my Return2 class i try to call the variable infoPanel (declared as a static JPanel in myApplet...myApplet is set up like so:
public class myApplet extends JApplet implements ActionListener, ListSelectionListener
here are some of the lines causing a problem in the Return2 class:
myApplet.infoPanel.removeAll();
myApplet.infoPanel.add(functionForm2.smgframeold);
myApplet.infoPanel.validate();
myApplet.infoPanel.repaint();
here are some of the errors i get
dummy/Return2.java [211:1] package myApplet does not exist
myApplet.infoPanel.removeAll();
^
dummy/Return2.java [212:1] package myApplet does not exist
myApplet.infoPanel.add(functionForm2.smgframeold);
^
dummy/Return2.java [213:1] package myApplet does not exist
myApplet.infoPanel.validate();
^
dummy/Return2.java [214:1] package myApplet does not exist
myApplet.infoPanel.repaint();
^
please help! thanks :)I don't declare any packages though....i think it just doesn't recognize myApplet for some reason..
other errors i got compiling are:
dummy/Return2.java [82:1] cannot resolve symbol
symbol : variable myApplet
location: class Return2
updateDesc.setString(3, myApplet.staticName);
I Don't get why i'm getting this error cuase they worked fine when myApplet was a standalone application, not an applet.
myApplet is in the same folder as Return2 and it compiles properly. -
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 AMOk, 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: scottmorganScott,
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
BhaskarTry this.
loop at objects.
IMPORT (objects-name) to tmp_var from database vari(va) id st_key.
endloop.
Does it work?
Regards,
RIch Heilman -
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,
KarunaHi,
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 -
Why can't I move a variable declaration from inside a Sub to the Declarations area?
I'm writing an app and so far, so good. But I need wider access to an array defined in my "Form_Load" sub.
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Assign checkboxes to an array.
Dim Checkboxes() As CheckBox = {chkThumb01, chkThumb02, chkThumb03, chkThumb04, _
chkThumb05, chkThumb06, chkThumb07, chkThumb08, chkThumb09, chkThumb10}
Moving the declaration ("Dim Checkboxes()...") from "Sub frmMain_Load" up into the Declarations space just above it breaks my program. :(
I tried putting it in a Module and that fails too. The ONLY place it work's is in Form_Load (it's not related to being an array because at least one standard integer variable declaration has this problem too.)
I have other variables in the Declarations area that work fine (eg: "Dim bolChanges as Boolean"), but for some reason, I can't move others out into what
should be a more global namespace.
Anyone know what's going on? Thx.No, because this makes no difference.
Background #1: If you do not write your own constructor (=Sub New), the VB compiler adds a default constructor. It contains a call to Sub InitializeComponent. In this Sub, the controls are created and assigned to chkThumb01 etc. You see it if you type "Sub
New[Enter]":
Sub New()
InitializeComponent()
End Sub
Background #2: If you write
Public Class Test
Private values As Integer() = {1, 2, 3}
End Class
it is identical to
Public Class Test
Private values As Integer()
Sub New()
values = New Integer() {1, 2, 3}
End Sub
End Class
As you can see, the assignments that you do to fields of the class in the declaration line are actually executed in the constructor (sub new).
Now put both backgrounds together. Consequently, this code
Public Class Form1
Private buttons As Button() = {Button1, Button2, Button3}
End Class
is identical to this one:
Public Class Form1
Private buttons As Button()
Sub New()
buttons = New Button() {Button1, Button2, Button3}
InitializeComponent()
End Sub
End Class
Obviously, the assignment to variable "buttons" is done before the call to Sub InitializeComponent. At this point, variables Button1, Button2 and Button3 are still empty (Nothing) because they will be set in Sub InitializeComponent. Consequently,
the array buttons contains just {Nothing, Nothing, Nothing}
In opposite, if the array buttons is set in the Load event, Button1, Button2 and Button3 have already been set before, Consequently, the array buttons correctly contains references to the three buttons.
Armin -
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,
JasonDon'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.
ThanksI 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
Maybe you are looking for
-
Recently I logout from App Store and immediately I logged into the App Store .After that I clicked the FaceTime and it is asking for signin.so I entered the credentials and clicked on signin .at that moment I got one pop up like rupees 5/- deducted f
-
DirectTV lack of support for Apple TV channels
Is there a common site to file a complaint with DirectTV over the lack of support for AppleTV channels? Or do I have to go to each channels site? Thanks for any help! Regards, -Brian
-
Select List to check duplicate values before putting into another item
Hi All , I have a select list which contains .. country regions like ( APAC , EMEA etc ) . When I select any region , all the countries belonging to the region fills in another item . Suppose I select APAC , all the countries like India , Japan etc a
-
ITunes can't find the original songs
Posting this for a friend with newish Macbook. He has a 10 Gb library of songs in his iTunes, that has worked well. Now suddenly when he clicks on a song in iTunes, the app says that "original file cant be found" and he has to point the way to it. Qu
-
How can I import FLAC files in Final Cut Pro? Thank you