Run function on multiple rows in a layout
Hi,
The client 's requirement is to run function on multiple rows in a layout at the user's will,the easiest way to add a indicator and then use this indicator as the condition in the function,but the problem is how to make this indicator.
The indicator can not be added to the leading column because it can not been check or uncheck manually by the user; the next option is to add it as the data column, but this make the data column look unnormal.
Anybody get better way to do this?
Thanks in advance.
Hi JW
Lets say you have used the keyfigure to identify whether the specific record is to be considered in fox and assume that the values for this key figure is 1to consider and 2-not consider then you can input these two values some place in layout in third step and put the excel validation on data column on these values so it will give the drop down box for the these values for data column.
Thanks,
Raj
Similar Messages
-
Can I use Concatenate function for multiple rows?
I have a lead list that contains 5000 leads. The format of this list contains address data that is saved in separate columns (ie: address, address 2, city, state, zip). I need this data in 1 column. I tried to use the concatenate function to combine the data for 1 row and it worked perfectly. I tried to do this for multiple rows and the function is greyed out. Is there a work around or way that I can combine this data for all 5000 rows without doing it 1 by one?
Look at this table;
In B9, the formula is;
=B2&" "&C2&" "&D2&" "&E2&" "&B3&" "&C3&" "&D3&" "&E3
Yvan KOENIG (VALLAURIS, France) dimanche 18 octobre 2009 20:51:47 -
How to disable resize function for multiple rows of inputText?
I have a multiple rows inputText component like below:
<af:inputText label="#{ZccToolbarGenBundle['OLabel.TransferNote']}"
id="it1" autoSubmit="true" columns="150"
immediate="true" simple="true" rows="5"
binding="#{transferBean.transferNoteText}"/>
How can I turn off the resizing icon on the bottom of right hand side of this input text box?
Thanks for any help.Timo, the bug that I filed has been changed to 'not a bug'. The reason of that is 'That correct as it is not a valid CSS style on all browsers'. I sent email to ADF faces team and got following answers: 1. StyleClass that has agent specific setting for this setting. 2. You put the style class in a skin file and reference it. you can not use the inline style notation. It wants a Style Class.
My question is what kind of StyleClass or skin file do you use so that you can use contentStyle="resize:none;"? Thanks. -
Displaying multiple rows in a form layout problem?
HI,
I displayed multiple rows using form layout,but form browse buttons displaying one row multiple times like if i click next it is displaying same rows in next page also ?
how can I prevent this?
very urgent
Thanks in advanceSet the table range size property to the number of rows you want to display.
Then as a post-generation action, drag and drop the Next Set and Previous Set operations of your View Object usage as buttons onto your page.
Then move the button code to a custom template, and uncheck group-level checkbox "Clear Page Definition before generation" to preserve the NextSet and PreviousSet action bindings.
Steven Davelaar,
JHeadstart Team. -
How to create a function that returns multiple rows in table
Dear all,
I want to create a funtion that returns multiple rows from the table (ex: gl_balances). I done following:
-- Create type (successfull)
Create or replace type tp_gl_balance as Object
PERIOD_NAME VARCHAR2(15),
CURRENCY_CODE VARCHAR2(15),
PERIOD_TYPE VARCHAR2(15),
PERIOD_YEAR NUMBER(15),
BEGIN_BALANCE_DR NUMBER,
BEGIN_BALANCE_CR NUMBER
-- successfull
create type tp_tbl_gl_balance as table of tp_gl_balance;
but i create a function for return some rows from gl_balances, i can't compile it
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
return
(select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period);
end;
I also try
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period;
return;
end;
Please help me solve this function.
thanks and best reguardhi,
Use TABLE FUNCTIONS,
[http://www.oracle-base.com/articles/9i/PipelinedTableFunctions9i.php]
Regards,
Danish -
Parallel run of the same function from multiple jobs
Hello, everyone!
I have a function which accepts a date range, reads invoices from a partitioned by date table and writes output to a partitioned by invoice table. Each invoice can have records only with one date, so both tables may have one invoice only in one partition, i.e. partitions do not overlap. Function commits after processing each date. The whole process was running about 6 hrs with 46 million records in source table.
We are expecting source table to grow over 150 million rows, so we decided to split it into 3 parallel jobs and each job will process 1/3 of dates, and, as a result, 1/3 of invoices.
So, we call this function from 3 concurrent UNIX jobs and each job passes its own range of dates.
What we noticed, is that even if we run 3 jobs concurrently, they do not run this way! When 1st job ends after 2 hrs of run, the number of commited rows in the target table is equal to the number of rows inserted by this job. When 2nd job ends after 4 hrs of run, the number of rows in the target table is equal the summary of two jobs. And the 3rd job ends only after 6 hrs.
So, instead of improving a process by splitting it into 3 parallel jobs we ended up having 3 jobs instead of one with the same 6 hrs until target table is loaded.
My question is - How to make it work? It looks like Oracle 11g is smart enough to recognize, that all 3 jobs are calling the same function and execute this function only once at the time. I.e. it looks like only one copy of the function is loaded into the memory at the same even if it called by 3 different sessions.
The function itself has a very complicated logic, does a lot of verifications by joining to another tables and we do not want to maintain 3 copies of the same code under different names. And beside this, the plan is that if with 150 mln rows we will have a performance problem, then split it to more concurrent jobs, for example 6 or 8 jobs. Obviously we do not want to maintain so many copies of the same code by copying this function into another names.
I was monitoring jobs by quering V$SESSION and V$SQLAREA ROWS_PROCESSED and EXECUTIONS and I can see, that each job has its own set of SID's (i.e. runs up to 8 parallel processes), but number of commited rows is always eqal to the number of rows from the 1st job, then 2nd+1st, etc. So, it looks like all processes of 2nd and 3rd jobs are waiting until 1st one is done.
Any ideas?OK, this is my SQL and results (some output columns are ommited as irrelevant)
SELECT
TRIM ( SESS.OSUSER ) "OSUser"
, TRIM ( SESS.USERNAME ) "OraUser"
, NVL(TRIM(SESS.SCHEMANAME),'------') "Schema"
, SESS.AUDSID "AudSID"
, SESS.SID "SID"
, TO_CHAR(SESS.LOGON_TIME,'HH24:MI:SS') "Sess Strt"
, SUBSTR(SQLAREA.FIRST_LOAD_TIME,12) "Tran Strt"
, NUMTODSINTERVAL((SYSDATE-TO_DATE(SQLAREA.FIRST_LOAD_TIME,'yyyy-mm-dd hh24:mi:ss')),'DAY') "Tran Time"
, SQLAREA.EXECUTIONS "Execs"
, TO_CHAR(SQLAREA.ROWS_PROCESSED,'999,999,999') "Rows"
, TO_CHAR(TRAN.USED_UREC,'999,999,999') "Undo Rec"
, TO_CHAR(TRAN.USED_UBLK,'999,999,999') "Undo Blks"
, SQLAREA.SORTS "Sorts"
, SQLAREA.FETCHES "Fetches"
, SQLAREA.LOADS "Loads"
, SQLAREA.PARSE_CALLS "Parse Calls"
, TRIM ( SESS.PROGRAM ) "Program"
, SESS.SERIAL# "Serial#"
, TRAN.STATUS "Status"
, SESS.STATE "State"
, SESS.EVENT "Event"
, SESS.P1TEXT||' '||SESS.P1 "P1"
, SESS.P2TEXT||' '||SESS.P2 "P2"
, SESS.P3TEXT||' '||SESS.P3 "P3"
, SESS.WAIT_CLASS "Wait Class"
, NUMTODSINTERVAL(SESS.WAIT_TIME_MICRO/1000000,'SECOND') "Wait Time"
, NUMTODSINTERVAL(SQLAREA.CONCURRENCY_WAIT_TIME/1000000,'SECOND') "Wait Concurr"
, NUMTODSINTERVAL(SQLAREA.CLUSTER_WAIT_TIME/1000000,'SECOND') "Wait Cluster"
, NUMTODSINTERVAL(SQLAREA.USER_IO_WAIT_TIME/1000000,'SECOND') "Wait I/O"
, SESS.ROW_WAIT_FILE# "Row Wait File"
, SESS.ROW_WAIT_OBJ# "Row Wait Obj"
, SESS.USER# "User#"
, SESS.OWNERID "OwnerID"
, SESS.SCHEMA# "Schema#"
, TRIM ( SESS.PROCESS ) "Process"
, NUMTODSINTERVAL(SQLAREA.CPU_TIME/1000000,'SECOND') "CPU Time"
, NUMTODSINTERVAL(SQLAREA.ELAPSED_TIME/1000000,'SECOND') "Elapsed Time"
, SQLAREA.DISK_READS "Disk Reads"
, SQLAREA.DIRECT_WRITES "Direct Writes"
, SQLAREA.BUFFER_GETS "Buffers"
, SQLAREA.SHARABLE_MEM "Sharable Memory"
, SQLAREA.PERSISTENT_MEM "Persistent Memory"
, SQLAREA.RUNTIME_MEM "RunTime Memory"
, TRIM ( SESS.MACHINE ) "Machine"
, TRIM ( SESS.TERMINAL ) "Terminal"
, TRIM ( SESS.TYPE ) "Type"
, SQLAREA.MODULE "Module"
, SESS.SERVICE_NAME "Service name"
FROM V$SESSION SESS
INNER JOIN V$SQLAREA SQLAREA
ON SESS.SQL_ADDRESS = SQLAREA.ADDRESS
and UPPER(SESS.STATUS) = 'ACTIVE'
LEFT JOIN V$TRANSACTION TRAN
ON TRAN.ADDR = SESS.TADDR
ORDER BY SESS.OSUSER
,SESS.USERNAME
,SESS.AUDSID
,NVL(SESS.SCHEMANAME,' ')
,SESS.SID
AudSID SID Sess Strt Tran Strt Tran Time Execs Rows Undo Rec Undo Blks Sorts Fetches Loads Parse Calls Status State Event P1 P2 P3 Wait Class Wait Time Wait Concurr Wait Cluster Wait I/O Row Wait File Row Wait Obj Process CPU Time Elapsed Time Disk Reads Direct Writes Buffers Sharable Memory Persistent Memory RunTime Memory
409585 272 22:15:36 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITED SHORT TIME PX Deq: Execute Reply sleeptime/senderid 200 passes 2 0 Idle 0 0:0:0.436000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 7 21777 22739 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 203 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.9674000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 25 124730 4180 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 210 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.11714000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 24 124730 22854 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 231 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.4623000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 46 21451 4178 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 243 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITED SHORT TIME PX qref latch function 154 sleeptime 13835058061074451432 qref 0 Other 0 0:0:0.4000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 35 21451 3550 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 252 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.19815000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 49 21451 22860 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 273 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.11621000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 22 124730 4182 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 277 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING db file parallel read files 20 blocks 125 requests 125 User I/O 0 0:0:0.242651000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 39 21451 4184 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 283 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.2781000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 42 21451 3552 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 295 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.24424000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 40 21451 22862 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409585 311 22:30:01 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.15788000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 31 21451 22856 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 242 22:15:36 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITED KNOWN TIME PX Deq: Execute Reply sleeptime/senderid 200 passes 1 0 Idle 0 0:0:0.522344000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 28 137723 22736 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 192 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.14334000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 31 21462 4202 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 222 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.16694000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 37 21462 4194 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 233 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.7731000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 44 21462 4198 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 253 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING db file parallel read files 21 blocks 125 requests 125 User I/O 0 0:0:0.792518000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 39 21462 4204 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 259 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.2961000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 35 21462 4196 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409586 291 22:29:20 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq Credit: send blkd sleeptime/senderid 268566527 passes 1 qref 0 Idle 0 0:0:0.9548000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 35 21462 4200 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409587 236 22:15:36 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq: Table Q Normal sleeptime/senderid 200 passes 2 0 Idle 0 0:0:0.91548000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 25 124870 22831 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409587 207 22:30:30 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq: Execution Msg sleeptime/senderid 268566527 passes 3 0 Idle 0 0:0:0.644662000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 43 21423 4208 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409587 241 22:30:30 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING PX Deq: Execution Msg sleeptime/senderid 268566527 passes 3 0 Idle 0 0:0:0.644594000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 47 21423 4192 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448
409587 297 22:30:30 22:15:36 0 0:14:52.999999999 302 383,521 305 0 1 3598 WAITING db file parallel read files 20 blocks 109 requests 109 User I/O 0 0:0:0.793261000 0 0:0:1.124995000 0 0:0:0.0 0 1:56:15.227863000 12 21316 4206 0 0:25:25.760000000 0 2:17:1.815044000 526959 0 25612732 277567 56344 55448Here I found one interesting query http://www.pythian.com/news/922/recent-spike-report-from-vactive_session_history-ash/
But it does not help me -
How to run a select count(*) with multiple rows returned
Hi,
I have to run a select count(*) for different reports.
1) Select count(*) from table
where state = 'CA'
2) Select count(*) from table
where state = 'NY'
3) Select count(*) from table
where state = 'NV'
Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.Samantha wrote:
Hi,
I have to run a select count(*) for different reports.
1) Select count(*) from table
where state = 'CA'
2) Select count(*) from table
where state = 'NY'
3) Select count(*) from table
where state = 'NV'
Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.select state, count(*) from table group by state order by 1; -
Need a function that return multiple rows
Hi,
I need a function that should return output of this query
SELECT b.branding_code, c.name_desc
FROM
development.brandings b, godot.company c
WHERE b.company_id = c.company_id;
This above function return 30 rows and I am not giving any input
Function using cursor,pipeline
Please help
Edited by: 1008783 on Jun 6, 2013 6:40 AMHi,
1008783 wrote:
Hi
Table A:
Development schema
branding_code,company_id
Table B:
Gogot schema
name_desc,...Those aren't CREATE TABLE and INSERT statements. Post something that the people who want to help you can run on their own systems to re-create the problem and test their ideas.
o/p:
branding_code,name_desc
I should return these column as o/p, no i/pA query will do that. There's no need for a function.
There are good reasons for wanting a functin. If you have one, say what it is. Explain how you plan to use the function.
Have you tried writing a function? Post your code. What specific problems did you have? -
Inserting multiples rows into a table using function or procedure..
How do i insert multiples rows into a table using function or procedure?
Please provide me query..Use FORALL bulk insert statement...
eg:
procedure generate_test_data as
type cl_itab is table of integer index by pls_integer;
v_cl_itab cl_itab;
type cl_vtab is table of varchar2(25) index by pls_integer;
v_cl_vtab cl_vtab;
type cl_dtab is table of date index by pls_integer;
v_cl_dtab cl_dtab;
begin
for i in 1.. 100 loop
v_cl_itab(i):= dbms_random.value(1,1000);
v_cl_vtab (i):=dbms_random.string('a',20);
v_cl_dtab (i):=to_date(trunc(dbms_random.value(2453737, 2454101)),'j');
end loop;
forall i in v_cl_itab.first .. v_cl_itab.last
execute immediate 'insert into test_order values( :n, :str , :dt ) ' using v_cl_itab(i), v_cl_vtab (i), v_cl_dtab (i);
commit;
end; -
Transfer multiple rows to function module
Hi Friends,
I have th following requirement.
In Visula composer I have 1 Input table.
Here I read rows from material master and I have a checkbox and a button transfer.
And I have a second table view with similar fields.
In the first table view I check several rows and when I press transfer.
Now I want all the checked rows of table view 1 to appear in table view 2.
For this reason I want to create a FM to keep the data in a table I have created.
In fact, I want to transfer the rows from table view 1 in a temp table and from there into table view 2.
But how can I transfer multiple rows from visual composer into the temp table by means of FM.
Many thanks for your help.
RG. JimbobConnect your table view 1 to your FM (make sure you flip the table on your FM to a input port).
Select the connector you just created and configure element. Set mapping scope to 'Selected Data Rows'. -
Retruring Multiple rows from a Stored Procedure
The Oracle JDBC documentation shows how to return a cursor pointer through the parameter list of a stored procedure allowing a Java program to use the cursor like a normal result set. I've tried it (using the thin driver) and it works fine - however, I'm having trouble getting this to work running the program under a Weblogic server (using their own JDBC implementation). So, I have two questions:
1) Has anyone had this problem before and solved it ??
2) Are there any other techniques for getting multiple rows back from the database without having to fire "raw" sql at it ?Hi
You could return not resultset but array, for example:
PACKAGE TEST:
type string_table is table of varchar2(80)
index by binary_integer;
function get_something (
something1 out string_table,
arraylength in number
) return number;
PACKAGE'S BODY:
function get_something (
something1 out string_table,
arraylength in number /** length of the array **/
) return number as
cursor C is
select something1, ...
from test_table;
pos number := 1;
begin
for position in C loop
exit when (pos > arraylength);
something1(pos) := position.something1;
pos := pos + 1;
end loop;
return (pos - 1);
end;
Of course in this example you need to know length of your array
(arraylength parameter), but you can avoid such problem, for
example, by using DBMS_SQL package (or dynamic SQL feature in
the Oracle8i).
Andrew
Mladen Gogala (guest) wrote:
: Phil Hildebrand (guest) wrote:
: : Is there a way that I can return multiple rows from a stored
: : procedure for function ?
: : Something like:
: : CREATE FUNCTION sp_get_children (my_nip IN port.nip_num%
TYPE)
: : RETURN my_nip
: : IS
: : CURSOR child_cur IS
: : SELECT nip_num
: : FROM logical_port
: : WHERE port_num = my_nip;
: : child_rec child_cur%rowtype;
: : BEGIN
: : FOR child_rec IN child_cur
: : LOOP
: : RETURN my_nip;
: : END LOOP;
: : END tmp_sp_get_children;
: : I know how to do it in Informix ( RETURN WITH RESUME ), but
: I'm
: : not running Informix ;)
: : Thanks,
: : Phil
: In contrast with Informix, SQL Server and Sybase, Oracle
: can not return a result set. the only workaround is to
: return the cursor variable as such.
null -
Generating multiple rows from one physical row
I was wondering if anyone has done or knows how to generate multiple rows for one physical row. In my query "SELECT Cust_No, Amount from Balances" if the amount is > 99,999.99 I want 2 rows returned, one with an amount of 90,000.00 and the other with an amount of 9,999.99. I'm thinking I need to use a view or function to return a result set but I'm not sure how.
Thanks in advance,
Allen Davis
[email protected]James,
Well your right in that you need a function, but also 3 views to accomplish that. I just wrote up the sql below and tested it. Basically you want the first view to return all records less than your cap of 99,999, thoes that exceed that will always return as 90,000 (see example on record PK 774177177). The second view returns money that remains AFTER the cap (in your case 9,999). The second view though also has to excude the ones less than the CAP.
DATA and TABLE layout
1) Table is called T1, columns are PK : primary key value, and N2 : some number column holding the MONEY amount
2) data is below fromtable called t1 (10 records) ...
select pk,n2 from t1 order by pk
PK N2
117165529 100
274000876 200000
350682010 9999
737652242 90000
774177177 99999
1369893126 1000
1663704428 100000
1720465556 8888
1793125955 0
1972069382 1000000
Now see the records with money at 99,999 (just like in your example). You want 2 records, so the VIEWS now come into play. The view itself CALLS the function, this occurs when you select from the view. The function will either return 90,000 (your defined cap) or the remained after subtracting the money from 90,000. The 3 views are defined below (the FUNCTION which is shown after will have to be compiled first) ...
--[VIEWS START]
CREATE OR REPLACE VIEW VIEW1
(PK,SHOW_MONEY)
AS SELECT PK,FN_TRIM_MONEY(N2,1) FROM T1;
CREATE OR REPLACE VIEW VIEW2
(PK,SHOW_MONEY)
AS SELECT PK,FN_TRIM_MONEY(N2,2) FROM T1 WHERE N2 >= 99999;
CREATE OR REPLACE VIEW VIEW_ALL
(PK,SHOW_MONEY)
AS
SELECT * FROM VIEW1
UNION ALL
SELECT * FROM VIEW2;
--[VIEWS END]
OK now for the actual function ...
--[FUNCTION START]
CREATE OR REPLACE FUNCTION
FN_TRIM_MONEY
PI_MONEY NUMBER,
PI_VIEW_ID NUMBER
RETURN NUMBER AS
LS_TEMP VARCHAR2(2000);
LI_TEMP NUMBER;
LD_TEMP DATE;
LI_CON_MONEY_MAX CONSTANT NUMBER := 90000;
LS_RETURN VARCHAR2(2000);
BEGIN
IF (PI_MONEY > LI_CON_MONEY_MAX) THEN
IF PI_VIEW_ID = 1 THEN
LI_TEMP := LI_CON_MONEY_MAX;
ELSIF PI_VIEW_ID = 2 THEN
LI_TEMP := (PI_MONEY - LI_CON_MONEY_MAX);
END IF;
ELSE
LI_TEMP := PI_MONEY;
END IF;
IF LI_TEMP < 0 THEN
LI_TEMP := 0;
END IF;
LS_RETURN := LI_TEMP;
RETURN LS_RETURN;
END;
SHOW ERRORS;
--[FUNCTION END]
I compiled the function and views with no errors. This is what I get when I query the 3 views ...
--[VIEW 1]
PK SHOW_MONEY
117165529 100
274000876 90000
350682010 9999
737652242 90000
774177177 90000
1369893126 1000
1663704428 90000
1720465556 8888
1793125955 0
1972069382 90000
--[VIEW 2]
PK SHOW_MONEY
274000876 110000
774177177 9999
1663704428 10000
1972069382 910000
--[VIEW ALL]
PK SHOW_MONEY
117165529 100
274000876 90000
274000876 110000
350682010 9999
737652242 90000
774177177 90000
774177177 9999
1369893126 1000
1663704428 90000
1663704428 10000
1720465556 8888
1793125955 0
1972069382 90000
1972069382 910000
So notice the PK entry 774177177 listed twice, once with 90,000 and other with 9,999. Also notice we now have 14 records from the original 10, meaning 4 records qualified for the split (all data from VIEW 2).
This is why Oracle kicks ass, views and functions are very powerful when used together and can return pretty much anything.
Thanks,
Tyler D.
[email protected] -
Calculated fields based on data in multiple rows
Hi,
I am using SOA Suite 11.1.1.4 for BAM.
Can someone please help explain to me if and how we can use calculated fields in BAM data objects where the calculations are not only based on the data for that row, but on multiple rows ?
Like for example, this case can easily be constructed -->
TestDataObject Layout
Column1 integer
Column2 integer
Column3 calculated = Column1 + Column2
But if I want to create something like this -->
TestDataObject Layout
Column1 integer
Column2 integer
Column3 calculated = max(Column1) + avg(Column2)
Is it possible to do the above ?
Is it possible to check multiple rows of the other columns while calculating a value ?
Thanks & Regards,
Karan.
Edited by: user8890668 on Mar 9, 2011 3:58 AMHi, Karan.
Do you know you can do that in reports with calculated fields?
I guess it is not possible using calculating functions offered in data objects to do that.
If you, or anybody, discover how do that, please tell us. I would like to know that.
Luciano Gomes
user8890668 wrote:
Hi,
I am using SOA Suite 11.1.1.4 for BAM.
Can someone please help explain to me if and how we can use calculated fields in BAM data objects where the calculations are not only based on the data for that row, but on multiple rows ?
Like for example, this case can easily be constructed -->
TestDataObject Layout
Column1 integer
Column2 integer
Column3 calculated = Column1 + Column2
But if I want to create something like this -->
TestDataObject Layout
Column1 integer
Column2 integer
Column3 calculated = max(Column1) + avg(Column2)
Is it possible to do the above ?
Is it possible to check multiple rows of the other columns while calculating a value ?
Thanks & Regards,
Karan.
Edited by: user8890668 on Mar 9, 2011 3:58 AM -
Multiple Rows Update / Refresh Toplink Query when database trigger involved
Hi everybody!
I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
1. Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
2. Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
Thanks in advance,
Alejandro TI didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
As I said, I never used it so that's pure theory. Someone else might know better, though. -
Multiple rows insertion - need help
Hello all,
I need to insert multiple rows in a table with a single query and the number of rows is 269470.
There are 3 columns in the table. One of the columns is determined by another sub query which returns multilple(269470) rows and the other 2 columns remain same for all.
I came up with the following query but need a loop to make it run multiple time(269470 times).
insert into EMLUSRRECV
(user_id, storeent_id, receiveml)
values
((select user_id from users where user_id not in (select distinct user_id from EMLUSRRECV) and CURR = 'USD' and rownum = 1), 11154, 1);
Thanks in advance.
Edited by: 924585 on Feb 20, 2013 7:19 PM924585 wrote:
Hello all,
I need to insert multiple rows in a table with a single query and the number of rows is 269470.
There are 3 columns in the table. One of the columns is determined by another sub query which returns multilple(269470) rows and the other 2 columns remain same for all.
I came up with the following query but need a loop to make it run multiple time(269470 times).
insert into EMLUSRRECV
(user_id, storeent_id, receiveml)
values
((select user_id from users where user_id not in (select distinct user_id from EMLUSRRECV) and CURR = 'USD' and rownum = 1), 11154, 1);
Thanks in advance.
Edited by: 924585 on Feb 20, 2013 7:19 PMwhy not just:
insert into emlusrrecv
select user_id, 11154, 1
from users
where user_id not in (select user_id from EMLUSRRECV)
and CURR = 'USD' and rownum = 1)
Maybe you are looking for
-
Undeliverable mail by MS Exchange server
I'm the dark horse trying to use Mail on an Exchange server at work. I spent yesterday getting the connection together, and it's all working fine except for this one thing. Everything I send bounces back to me as undeliverable with the following mess
-
3TB HDD, GPT, EXT4 HPA enabled, [SOLVED]
I started my HTPC as usual, only to be greeted with "movie share" not found. I was suprised, looking at console, it seemed the kernely suddently stopped looking for my HDD. Manually mounting the HDD mount -t ext4 /dev/sdg1 /mnt
-
Update Installation Problems for Acro 8.1.6-7
I'm new at Acrobat. I work on an iMac Intel 2GHz intel Core 2 Duo with 1GB ram. OSX 10.6.2. I'm using Acrobat 8.1.5. Updates for 8.1.7 and 8.1.7 won't install. Error says something about "...plugins" and requests that I reinstall the native app. Anyb
-
Windows host view of VBox host only adapter
This question was brought to my attention a few days ago by someone who thought the Vbox hostonly adapter got its IP address from the user's router. I had a difficult time setting him straight, but he did have a configuration that is puzzling. On t
-
Windows XP couldn't remote desktop Windows2012
Hi Everyone: I have an issue as the following lines indicates. "An authentication error has occured.The specified target is unknown or unreachable" The remote side is Server2012,however the Windows 7 client can remote desktop the Windows Server 2012