Easy Question:Select many rows from a table and execute BAPI for these rows
Hi Experts,
I have created one WD project. The WD project fetches some records of backend using BAPI and displays in a table. I have to select some rows from the table and then execute BAPI for selected rows.
How I can select multiple records from the table and then execute another BAPI for selected rows.
Regards,
Gary
Hi,
In the Node which you binded to the table create one more attribute of type boolean.
For example your node is as below:
//Table Node
TableNode
> Att1
> Att2
> isSelected(boolean) - Newly created attribute for this requirement.
//Result Node contains the elements selected in TableNode
ResultNode
>Att1
>Att2
Now in the table create one more Column with Checkbox as tablecell editor. Now bind this boolean attribute to that check box.
Now in the code you can get the selected rows by user as below:
for(int i=0;i<TableNode().size();i++)
if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
wdContext.nodeResultNode().addElement(element);
Regards,
Charan
Similar Messages
-
Select a row from a table and throw an url
Hi experts,
I'm trying to select a row from a table in Visual Composer. What I need to do it's to click over this row and throw an Url. At the moment, I've added a column with a Pushbutton with the formula to show the link; it works fine. But I need to do it without buttons just selecting the row.
Is there anyboby who knows about that?
Thanks a lot.
BelenHi
To do this you will have to use a data store and a guard condition on the line which is triggered by the select action. You need to store a value in the data store each time a select action is performed. The guard condition should check for this and only perform the action when the value in the data store is greater than 0.
Jarrod Williams -
Select sql running very long when made to select many columns from a table
Hi,
I am using an Oracle DB 10g. I have a table with 250 columns and I need to select 200 columns out of them. The table holds around 0.1 million rows. But when I run the select sql it takes 15 mins to return .1 million rows. Where as if I select only 10 or 15 columns the sql runs in less than a minute returning same number of rows. My sql looks like below:
select p.col1,p.col2,.......,p.col200
from table Parent p;
The table also has a Primary key Index but it does not seem to be using it even when I forced an Index hint. Could you pls help?961796 wrote:
I am using an Oracle DB 10g. I have a table with 250 columns and I need to select 200 columns out of them. The table holds around 0.1 million rows. But when I run the select sql it takes 15 mins to return .1 million rows. Where as if I select only 10 or 15 columns the sql runs in less than a minute returning same number of rows. My sql looks like below:
As Sven points out, it is likely that most of your time is network (and client) time. You are sending 20 times as much data (based on column counts, at any rate) across the network, and concerned that it's taking 15 times as long.
If you're testing from SQL*Plus then setting the arraysize to a value larger than the default might help.
If you have control over the SQL*Net settings then you may get some benefit by adjusting the SDU sizes at both ends of the link.
If you have control over the tcp configuration (transmit and receive buffer sizes) then you may get some benefit by adjusting these.
Simple test, by the way, if you're on SQL*Plus
set autotrace traceonly statistics
select ...This will dump your data in the bit bucket as it arrives giving you
a) the database time plus network time
b) some statistics including the volume of data down the network and the number of network round-trips that Oracle saw.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
Author: <b><em>Oracle Core</em></b> -
Subtract sum of two columns in two different tables and display balance for each row
Hello Friends,
I have the below 5 tables
1. STUDENT (STUDENT_ID, NAME)
2. DEPARTMENT (DEPT_ID, NAME, CONTACT_PERSON, PHONE)
3. SECTION (SECTION_ID,SNAME,DEPT_ID,Acad_LEVEL,SHIFT,TIME,ROOM)
4. TUITION_BILL (Seq_No, STUDENT_ID, DEPT_ID, Acad_Level, SECTION_ID, SEMESTER, Acad_Year, BILL_DATE, GROSS_AMT_DUE)
5. TUITION_PAYMENT (Seq_No,RECEIPT_NO,STUDENT_ID,DEPT_ID,Acad_Level,SECTION_ID,SEMESTER,Acad_Year,SCHOLARSHIP,PAYMENT_DATE,PAYMENT_AMT,REFERENCE,REMARKS)
I wrote the following query
SELECT T.Seq_No,T.STUDENT_ID,S.NAME As STUDENT_NAME,d.name As DEPT,T.Acad_Level,c.SNAME As SECTION,
T.SEMESTER,T.[Acad_Year],BILL_DATE,GROSS_AMT_DUE,
COALESCE(SUM(T.GROSS_AMT_DUE),0)-COALESCE(SUM(PAY.PAYMENT_AMT),0)- COALESCE(SUM(PAY.SCHOLARSHIP),0) As BALANCE
FROM TUITION_BILL T JOIN STUDENT S ON S.STUDENT_ID=T.STUDENT_ID join DEPARTMENT d on d.DEPT_ID=T.DEPT_ID
join SECTION c on c.SECTION_ID=T.SECTION_ID LEFT JOIN (SELECT DISTINCT STUDENT_ID,COALESCE(SUM(p.PAYMENT_AMT),0) As PAYMENT_AMT,
COALESCE(SUM(P.SCHOLARSHIP),0) As SCHOLARSHIP FROM TUITION_PAYMENT p GROUP BY p.STUDENT_ID) As PAY ON PAY.STUDENT_ID=T.STUDENT_ID
WHERE s.STUDENT_ID='138218' GROUP BY T.Seq_No,T.STUDENT_ID,S.NAME,d.NAME,T.[Acad_Level],c.SNAME,T.SEMESTER,
T.[Acad_Year],BILL_DATE,GROSS_AMT_DUE,PAYMENT_AMT,SCHOLARSHIP
The above query shows the below output
Seq_No
STUDENT_ID
STUDENT_NAME
DEPT
Acad_Level
SECTION
SEMESTER
Acad_Year
BILL_DATE
GROSS_AMT_DUE
BALANCE
1
138218
Abdirahman Dhuh Gamadid
Agriculture and Veterinary
Year 2
2A
One
2014-2015
1/10/2014
200
0
5638
138218
Abdirahman Dhuh Gamadid
Agriculture and Veterinary
Year 2
2A
Two
2014-2015
3/20/2015
200
0
There are two records in the TUITION_BILL table with different Semesters and bill dates for the specified student_id and there is only one record in the TUITION_PAYMENT table which is the semester one payment record. Semester two payment record
is not recorded yet and I want to display the balance like the following output instead of the above output.
Seq_No
STUDENT_ID
STUDENT_NAME
DEPT
Acad_Level
SECTION
SEMESTER
Acad_Year
BILL_DATE
GROSS_AMT_DUE
BALANCE
1
138218
Abdirahman Dhuh Gamadid
Agriculture and Veterinary
Year 2
2A
One
2014-2015
1/10/2014
200
0
5638
138218
Abdirahman Dhuh Gamadid
Agriculture and Veterinary
Year 2
2A
Two
2014-2015
3/20/2015
200
200
The above query is working fine but I'm facing only one problem with it which its showing 0 balance for both records instead of different balances like the above desired output.
Please help me in getting the desired result.
Any help would be appreciated.
Thanks in advance,
MohamoudThanks a lot Pituach for your reply; below I posted the script for the database and table creation and inserting sample data into the tables.
CREATE
DATABASE TESTdb
GO
USE TESTdb
CREATE
TABLE [dbo].[STUDENT](
[STUDENT_ID] [int]
NOT NULL,
[NAME] [varchar](40)
NULL,
PRIMARY
KEY CLUSTERED
[STUDENT_ID]
ASC
)WITH
(PAD_INDEX
= OFF,
STATISTICS_NORECOMPUTE
= OFF,
IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS
= ON,
ALLOW_PAGE_LOCKS =
ON)
ON [PRIMARY]
ON [PRIMARY]
GO
SET
ANSI_PADDING OFF
GO
CREATE
TABLE [dbo].[DEPARTMENT](
[DEPT_ID] [int]
IDENTITY(1,1)
NOT NULL,
[NAME] [varchar](30)
NULL,
[CONTACT_PERSON] [varchar](40)
NULL,
[PHONE] [int]
NULL,
CONSTRAINT [PK__DEPARTME__512A59AC03317E3D]
PRIMARY KEY
CLUSTERED
[DEPT_ID]
ASC
)WITH
(PAD_INDEX
= OFF,
STATISTICS_NORECOMPUTE
= OFF,
IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS
= ON,
ALLOW_PAGE_LOCKS =
ON)
ON [PRIMARY]
ON [PRIMARY]
GO
SET
ANSI_PADDING OFF
GO
CREATE
TABLE [dbo].[SECTION](
[SECTION_ID] [int]
IDENTITY(1,1)
NOT NULL,
[SNAME] [varchar](40)
NOT NULL,
[DEPT_ID] [int]
NOT NULL,
[Acad_Level] [varchar](30)
NULL,
[SHIFT] [varchar](20)
NULL,
[TIME] [varchar](20)
NULL,
[ROOM] [varchar](20)
NULL,
CONSTRAINT [PK__SECTION__92F8069507020F21]
PRIMARY KEY
CLUSTERED
[SECTION_ID]
ASC,
[DEPT_ID]
ASC
)WITH
(PAD_INDEX
= OFF,
STATISTICS_NORECOMPUTE
= OFF,
IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS
= ON,
ALLOW_PAGE_LOCKS =
ON)
ON [PRIMARY]
ON [PRIMARY]
GO
SET
ANSI_PADDING OFF
GO
CREATE
TABLE [dbo].[TUITION_BILL](
[Seq_No] [int]
IDENTITY(1,1)
NOT NULL,
[STUDENT_ID] [int]
NOT NULL,
[DEPT_ID] [int]
NOT NULL,
[Acad_Level] [varchar](50)
NOT NULL,
[SECTION_ID] [int]
NOT NULL,
[SEMESTER] [varchar](50)
NOT NULL,
[Acad_Year] [varchar](50)
NOT NULL,
[BILL_DATE] [date]
NULL,
[GROSS_AMT_DUE] [decimal](18, 2)
NULL,
CONSTRAINT [PK_TUITION_BILL]
PRIMARY KEY
CLUSTERED
[STUDENT_ID]
ASC,
[DEPT_ID]
ASC,
[Acad_Level]
ASC,
[SEMESTER]
ASC,
[Acad_Year]
ASC
)WITH
(PAD_INDEX
= OFF,
STATISTICS_NORECOMPUTE
= OFF,
IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS
= ON,
ALLOW_PAGE_LOCKS =
ON)
ON [PRIMARY]
ON [PRIMARY]
GO
SET
ANSI_PADDING OFF
GO
CREATE
TABLE [dbo].[TUITION_PAYMENT](
[Seq_No] [int]
IDENTITY(1,1)
NOT NULL,
[RECEIPT_NO] [int]
NOT NULL,
[STUDENT_ID] [int]
NOT NULL,
[DEPT_ID] [int]
NOT NULL,
[Acad_Level] [varchar](50)
NOT NULL,
[SECTION_ID] [int]
NOT NULL,
[SEMESTER] [varchar](50)
NOT NULL,
[Acad_Year] [varchar](50)
NOT NULL,
[SCHOLARSHIP] [decimal](18, 2)
NULL,
[PAYMENT_DATE] [date]
NULL,
[PAYMENT_AMT] [decimal](18, 2)
NULL,
[REFERENCE] [varchar](50)
NULL,
[REMARKS] [varchar](max)
NULL,
CONSTRAINT [PK_TUITION_PAYMENT]
PRIMARY KEY
CLUSTERED
[Seq_No]
ASC
)WITH
(PAD_INDEX
= OFF,
STATISTICS_NORECOMPUTE
= OFF,
IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS
= ON,
ALLOW_PAGE_LOCKS =
ON)
ON [PRIMARY]
ON [PRIMARY]
GO
SET
ANSI_PADDING OFF
GO
USE TESTdb
INSERT
INTO STUDENT(STUDENT_ID,NAME)VALUES(138218,'Abdirahman
Dhuh Gamadid')
INSERT
INTO DEPARTMENT(NAME,CONTACT_PERSON,PHONE)VALUES('Agriculture
and Veterinary','Mohamoud Abdilahi','065')
INSERT
INTO SECTION(SNAME,DEPT_ID,Acad_Level,SHIFT,[TIME],ROOM)VALUES('2A',1,'Year
2','Morning','8:00-10:00','Room 1')
INSERT
INTO TUITION_BILL(STUDENT_ID,DEPT_ID,Acad_Level,SECTION_ID,SEMESTER,Acad_Year,BILL_DATE,GROSS_AMT_DUE)
VALUES(138218,1,'Year
2',1,'One','2014-2015','2014-09-10',200.00)
INSERT
INTO TUITION_BILL(STUDENT_ID,DEPT_ID,Acad_Level,SECTION_ID,SEMESTER,Acad_Year,BILL_DATE,GROSS_AMT_DUE)
VALUES(138218,1,'Year
2',1,'Two','2014-2015','2015-01-10',200.00)
INSERT
INTO TUITION_PAYMENT(RECEIPT_NO,STUDENT_ID,DEPT_ID,Acad_Level,SECTION_ID,SEMESTER,Acad_Year,SCHOLARSHIP,
PAYMENT_DATE,PAYMENT_AMT,REFERENCE,REMARKS)VALUES(1,138218,1,'Year
2',1,'One','2014-2015',0.00,'2014-10-10',200.00,'N','N') -
Select unique rows from two tables...
Hi,
I have two tables, replies1 and replies2.
SQL> desc replies
Name Null? Type
URN VARCHAR2(36)
ADDRESS VARCHAR2(18)
FILESIZE NUMBER
AS_NUM VARCHAR2(6)
SQL> desc replies2
Name Null? Type
URN VARCHAR2(36)
ADDRESS VARCHAR2(18)
AS_NUM VARCHAR2(6)
Both of the tables have no primary keys, but I have indixes on (urn, addrss) combination on both....
I am trying to select the unique rows with (urn, address) from replies2, and then find the matching size from replies...
I am using the following query:
select distinct replies2.urn, replies2.address, replies.filesize from replies2, replies where replies2.AS_NUM like 'XYZ' and replies.urn = replies2.urn;
I cannot figure out why it won't work. the way I understand it is that, distinct will give all distinct combination of all column names that follow, which is what I want...
I know it is wrong, because the query:
select count(*) from replies2 where AS_NUM like 'XYZ' returns less number of rows than the above query.
Any help would be greatly appreciated.
Thank you
Oz.Thanks a lot Mohan for your reply.
urn is not a unique key. Several rows could have the same (urn, address) pair in both tables. What I want is retrieve all (urn, address) rows from one table, and find the size from the other table to make a (urn, address, size). I want all unique combinations of (urn, address) to appear in the output.
AS_NUM is an empty column in replies... It would've been a lot easier if it wasn't, since then I'll just say: select distinct urn, address, filesize from replies where AS_NUM like 'XYZ';
I will try your query though and let u know how it goes. It takes quite a while to run since my tables are huge. -
Hi ,
I have a table with 20 records and 10 columns.I want to add columns from another table with out cross join.As others have said, you need to have some sort of join condition otherwise it is a cross join.
SQL> ed
Wrote file afiedt.buf
1 with T1 as (select 'e' as c1, 2 as c2 from dual union all
2 select 'd', 3 from dual)
3 ,T2 as (select 'x' as c3, 5 as c4 from dual union all
4 select 'y', 6 from dual union all
5 select 'z', 2 from dual)
6 --
7 select T2.c3, T2.c4, T1.c1, T1.c2
8 FROM (select c1, c2, row_number() over (order by c1) as rn from T1) T1
9 FULL OUTER JOIN
10 (select c3, c4, row_number() over (order by c3) as rn from T2) T2
11* ON (T1.rn = T2.rn)
SQL> /
C C4 C C2
x 5 d 3
y 6 e 2
z 2
SQL>This example assigns a row number to each row within each table and then joins using that row number.
(I've assumed the row number should be generated based on the order of the first column of each table, but you can change that as required).
What is the point of your requirement? -
Need of SQL query in selecting distinct values from two tables
hi,
I need a query for selecting distinct values from two tables with one condition.
for eg:
there are two tables a & b.
in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
can anybody please help me.
Thanks in advance,
RatheeshNot sure what you mean either, but perhaps this will start a dialog:
SELECT DISTINCT a.empno,
a.name,
a.sex,
b.salary,
b.doj
FROM a,
b
WHERE a.empno = b.empno;Greg -
Best practice for deleting multiple rows from a table , using creator
Hi
Thank you for reading my post.
what is best practive for deleting multiple rows from a table using rowSet ?
for example how i can execute something like
delete from table1 where field1= ? and field2 =?
Thank youHi,
Please go through the AppModel application which is available at: http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
The OnePage Table Based example shows exactly how to use deleting multiple rows from a datatable...
Hope this helps.
Thanks,
RK. -
Update row in a table based on join on multiple rows in another table
I am using SQL Server 2005. I have the following update query which is not working as desired.
UPDATE DocPlant
SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID
For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. But the above update query is considering only one row from
PlantAction table even though there are multiple rows that match with DocID and PlantID.
DocHistory column is of type NVARCHAR(MAX).
How do I fix my query to achieve what I want ? Thanks for the help.UPDATE DocPlant
SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID
We do not use the old Sybase UPDATE..FROM.. syntax. Google it and learn how it does not work. We do not use the old Sybase CONVERT() string function. You are still writing 1950's COBOL with string dates instead of temeproal data types.
You also did not post DDL, so we have to guess about everything. Does your boss make you work without DDL? How do you do it?
>> For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction [singular name?] table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. <<
Why? What does this new data element mean? This is like dividing Thursday by Red and expecting a reasonable answer. Now, non-SQL programmers who are still writing COBOL will violate the tiered architecture rule about doing display formatting in the database.
If you will follow forum rules, we can help you.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Select multiple rows from dual table
Is it possible to select multiple rows from dual table using a single select statement.
i.e., i want the out put to be
column_name
1
2
3
4
Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AMAside from the fact you're responding to an old thread...
1002424 wrote:
While using CONNECT BY, I see it always leave behind one row.
Suppose I have a condition based on which I have to generate constant rows like
SELECT 1 FROM DUAL WHERE ROWNUM < N;
Here if N = 0, still it gives out single row.... you are obviously doing something wrong in your code elsewhere, because that SQL statement does not always return a single row...
SQL> SELECT 1 FROM DUAL WHERE ROWNUM < 0;
no rows selected
SQL> -
Fetching more than one row from a table after selecting one value from the dropdown
Hi Experts,
How can we fetch more than one row from a table after selecting one value from the dropdown.
The scenario is that I have some entries in the dropdown like below
A B C
11256 VID 911256
11256 VID 811256
11256 SONY 11256
The 'B' values are there in the dropdown. I have removed the duplicate entries from the dropdown so now the dropdownlist has only two values.for eg- 'VID' and'SONY'. So now, after selecting 'VID' from the dropdown I should get all the 'C' values. After this the "C' values are to be passed to other methods to fetch some data from other tables.
Request your help on this.
Thanks,
Preeetam Narkhede.Hi Preetam!
I hope I understand your request proberly, since this is more about Java and less about WebDynpro, but if I'm wrong, just follow up on this.
Supposed you have some collection of your original table data stored in variable "origin". Populate a Hashtable using the values from column "B" (let's assume it's Strings) as keys and an ArrayList of whatever "C" is (let's assume String instances, too) as value (there's a lot of ways to iterate over whatever your datasource is, and since we do not know what your datasource is, maybe you'll have to follow another approach to get b and c vaues,but the principle should remain the same):
// Declare a private variable for your Data at the appropriate place in your code
private Hashtable temp = new Hashtable<String, ArrayList<String>>();
// Then, in the method you use to retrieve backend data and populate the dropdown,
// populate the Hashtable, too
Iterator<TableData> a = origin.iterator();
while (a.hasNext()) {
TableData current = a.next();
String b = current.getB();
String c = current.getC();
ArrayList<String> values = this.temp.get(b);
if (values == null) {
values = new ArrayList<String>();
values.add(c);
this.temp.put(b, values);
So after this, you'll have a Hashtable with the B values als keys and collections of C values of this particular B as value:
VID --> (911256, 811256)
SONY --> (11256)
Use
temp.keySet()
to populate your dropdown.
After the user selects an entry from the dropdown (let's say stored in variable selectedB), you will be able to retrieve the collection of c's from your Hashtable
// In the metod you handle the selection event with, get the c value collection
//and use it to select from your other table
ArrayList<String> selectedCs = this.temp.get(selectedB);
// now iterate over the selectedCs items and use each of these
//to continue retrieving whatever data you need...
for (String oneC : selectedCs) {
// Select Data from backend using oneC in the where-Clause or whatever...
Hope that helps
Michael -
How to save the selected rows from Advance table into database
Hi
I have requirement like..
In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
The reqt is how to save the selected multiple rows into the database.hi Reetesh,
In Custom page
Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
So in Such scenario how to save this 10 rows against Recruiter
, i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
I hope u understand my question -
How NOT to restrict no of rows from two tables
I have two identical tables Invoice and Payment. The only difference is Invoice_id,Invoice_Amt and Payment_id,Payment_Amt columns that shows different ids and amounts. The bank_ids, names, account_types are same. Invoice table has 3 rows and Payment has 2. Simply meaning that there were 3 invoices generated but the bank received 2 payments. I want to show Invoice_Amt and Payment_Amt using sql query. But its giving me total 6 rows. Whereas, I want 3 from Invoice and 2 rows from Payment table to show side-by-side.
CREATE TABLE invoice
( invoice_id NUMBER
bank_id NUMBER,
bank_name VARCHAR2(256),
invoice_amount NUMBER);
----Invoice table has 3 rows showing 3 Invoice Amts
CREATE TABLE payment
( payment_id NUMBER
bank_id NUMBER,
bank_name VARCHAR2(256),
payment_amount NUMBER);
----Payment table has 2 rows showing 2 Payments
After executing this sql statement below, I get 6 rows:
select inv.invoice_amount,pymt.payment_amount from invoice inv,payment pymt where inv.bank_id=pymt.bank_id;
How can I show 3 rows for Invoice and 2 for Payment..?
Thank you.Hi,
So you want
the 1st invoice to appear side-by-side with the 1st payment,
the 2nd invoice to appear side-by-side with the 2nd payment,
the nth invoice to appear side-by-side with the nth payment.
But, if there are an uneqaul numner of payments and invoices, all the payments and all the invoices must still be shown, alone on a row if necessary.
That sounds like a job for FULL OUTER JOIN.
Use the analytic ROW_NUMBER fucntion to determine which is the 1st, 2nd, ..., nth row in each table, for each bank.
WITH invoice_plus_r_num AS
SELECT bank_id, bank_name
, invoice_amount
, ROW_NUMBER () OVER ( PARTITION BY bank_id, bank_name
ORDER BY invoice_id
) AS r_num
FROM invoice
, payment_plus_r_num AS
SELECT bank_id, bank_name
, payment_amount
, ROW_NUMBER () OVER ( PARTITION BY bank_id, bank_name
ORDER BY payment_id
) AS r_num
FROM payment
SELECT NVL (i.bank_id, p.bank_id) AS bank_id
, NVL (i.bank_name, p.bank_name) AS bank_name
, i.invoice_amount
, p.payment_amount
FROM invoice_plus_r_num i
FULL OUTER JOIN payment_plus_r_num p ON i.bank_id = p.bank_id
AND i.bank_name = p.bank_name
AND i.r_num = p.r_num
ORDER BY bank_id -- you can use column aliases here
, bank_name
, NVL (i.r_num, p.r_num)
;You mentioned something about accounts, but didn't include that in the CREATE TABLE statements. You'll probably want to add that wherever I used bank_id and bank_name, above.
Are invoce and payment actually views, rather than tables? If not, you should have a separate bank table, and only include the bank_id in the other tables.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on Feb 3, 2011 12:32 PM -
Deleting Multiple Rows From Multiple Tables As an APEX Process
Hi There,
I'm interesting in hearing best practice approaches for deleting multiple rows from multiple tables from a single button click in an APEX application. I'm using 3.0.1.008
On my APEX page I have a Select list displaying all the Payments made and a user can view individual payments by selecting a Payment from the Select List (individual items are displayed below using Text Field (Disabled, saves state) items with a source of Database Column).
A Payment is to be deleted by selecting a custom image (Delete Payments Button) displayed in a Vertical Images List on the same page. The Target is set as the same page and I gave the Request a name of DELETEPAY.
What I tried to implement was creating a Conditional Process On Submit - After Computations and Validations that has a source of a PL/SQL anonymous block as follows:
BEGIN
UPDATE tblDebitNotes d
SET d.Paid = 0
WHERE 1=1
AND d.DebitNoteID = :P7_DEBITNOTEID;
INSERT INTO tblDeletedPayments
( PaymentID,
DebitNoteID,
Amount,
Date_A,
SupplierRef,
Description
VALUES
( :P7_PAYMENTID,
:P7_DEBITNOTEID,
:P7_PAID,
SYSDATE,
:P7_SUPPLIERREF,
:P7_DESCRIPTION
DELETE FROM tblPayments
WHERE 1=1
AND PaymentID = :P7_PAYMENTID;
END;
The Condition Type used was Request = Expression 1 where Expression 1 had a value of DELETEPAY
However this process is not doing anything!! Any insights greatly appreciated.
Many thanks,
Gary....the "button" is using a page level Target,...
I'm not sure what that means. If the target is specified in the definition of a list item, then clicking on the image will simply redirect to that URL. You must cause the page to be submitted instead, perhaps by making the URL a reference to the javaScript doSubmit function that is part of the standard library shipped with Application Express. Take a look at a Standard Tab on a sample application and see how it submits the page using doSubmit() and emulate that.
Scott -
How to delete multiple rows from ADF table
How to delete multiple rows from ADF table
Hi,
best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
Frank
Maybe you are looking for
-
The ipad screen is white. Holding buttons didn't work so I restored it on iTunes. When I press home and on switch, the screen is white, goes black then back to white with no logo at all. Can't get past the white screen. This happened after running a
-
HD video and Jpeg pics in the same project/sequence?
I want to use both HD video (1929x1084;24bps) and Jpeg pictures from my DSLR camera in the same sequence. My problem is that when i choose the correct presets for the video (DSLR 1080p24) then the Jpegs gets cropped in the program monitor (I only see
-
Hi Gurus, I've just set up email notification for Workstatus. I works fine but I've noticed something that won't be accepted by my customer : I Had created a BPC Service User SMAIL to send email notification. But it is useless since the email notific
-
Low Resolution Address Book Dock Icon
A friend of mine had managed to trash Address Book so I reinstalled it using "Optional Installs" from the iMac Mac OS X Install DVD. Install was successful but when I add the Address Book icon to the dock it looks blurry and slightly pixelated. The A
-
Event handling for loop??
Hi all, Been busy making this budget applet and have run into some trouble with my JTable. Each time a user inputs a selection, it is supposed to return values in the first column only. The next time a user inputs an amount, it should go into the nex