Querying the differnetiated columns
hi,
can any one help me plz..
i have two tables, with the same columns(data types and column names), i have to join these two tables and see if there is any difference in the values(of two columns of same name) and print if the values are equal or not
i did this using decode for simple columns(with out using functions, ,like sum, nvl-- decode(table1.col1, table2.col2, 'equal','notequal' )
BUT i have to first work out with two columns of the same table and name it (table1) ( sum( nvl( table1.col1,0)-nvl(table1.col2,0) X, sum( nvl(table1.col3,0)-nvl( table1.col4,0) Y)
similarly for table 2( sum( nvl(table2.col1,0)-nvl(table2.col2,0) X, sum( nvl(table2. col3,0)-nvl(table2.col4,0) Y )
and then join join these two tables and compare two different columns with same name( x with x, y with y)
and say if they r equal or not.
thanks in advance
not sure if I have the syntax of this down pat as I didn't have your tables to mess with
but I think you could use 2 inline views
something like this maybe.
select
inline_view_1.X, inline_view_2.X,
case when inline_view_1.X = inline_view_2.X then 'equal' else 'not equal' end as is_x_equal,
inline_view_2.Y, inline_view_2.Y,
case when inline_view_1.Y = inline_view_2.Y then 'equal' else 'not equal' end as is_y_equal,
from
( select
table1.foreign_key_to_table_2 fk,
sum( nvl( table1.col1,0)-nvl(table1.col2,0) X,
sum( nvl(table1.col3,0)-nvl( table1.col4,0) Y
group by fk
) inline_view_1 join
( select
table2.foreign_key_to_table_1 fk, fk,
sum( nvl(table2.col1,0)-nvl(table2.col2,0) X,
sum( nvl(table2. col3,0)-nvl(table2.col4,0) Y
group by fk
) inline_view_2
using (fk)
Similar Messages
-
Supress the ROW_ID column in the Select Query.
Hi,
I have one custom form and from main form I am calling the Line Form.
But when I am clicking the LINE button then Form is getting open but it is giving one Error message like
FRM-40505: Oracle Error:unable to perform query
Once I check the Detail error.
it is giving me this message.
ORA-00904: "ROW_ID": invalid identifier
And I checked the query my query is returning the ROW_ID column.
Please help on Suppressing the Row_id column getting selected from the query.
Thanks
NiharHi Nihar;
Please see:
Transactions Workbench Error: Listing of FRM Errors [ID 1321612.1]
Regard
Helios -
In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .
Hi Srinath,
The below blog might be useful
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
regards,
Harish -
SQL Query - The number of columns specified in "SQL Query" does not match t
I am creating new UDM for tablespace alert, below is my query,however its failing with error
SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
I selected Metric type is number
SQL Query Format : Two columns
Query:
SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
Any clues why i am getting error.SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
TABLESPACE_NAME USED_PCT
MGMT_TABLESPACE .82
SYSAUX 1.52
UNDOTBS1 .32
RMAN .02
CORRUPT_TS 10.63
USERS 0
SYSTEM 2.26
MGMT_ECM_DEPOT_TS .04
MGMT_AD4J_TS 0 -
The issue with using the multiple columns sub-query in WHERE clause
Hi All,
my database version is 10.2.
the problem i am trying to deal with is that when I use multiple column sub-query in the WHERE clause of the SELECT statement, the actual row number returned from the sub-query is different from the whole statement.
And what I found is that, whenever there is NULL in any of those columns returned from the SUB-QUERY, the outer query will just return NULL for that whole row.
Here is an example:
select empno, ename, job, mgr, hiredate, sal, deptno from EMP
intersect
select empno, ename, job, mgr, hiredate, sal, deptno from t;
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT NULL 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
select * from EMP where (EMPNO, ENAME, job, MGR, HIREDATE, SAL, DEPTNO) in (
select empno, ename, job, mgr, hiredate, sal, deptno from EMP
intersect
select empno, ename, job, mgr, hiredate, sal, deptno from t);
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10 If I specifically deal with the NULL situations for the columns which might return NULL, I can get the result right.
select * from EMP where (EMPNO, ENAME, job, NVL(MGR,-1), HIREDATE, SAL, DEPTNO) in (
select empno, ename, job, nvl(mgr,-1), hiredate, sal, deptno from EMP
intersect
select empno, ename, job, nvl(mgr,-1), hiredate, sal, deptno from t);
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT null 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10 the problem is that, I feel this is a very lame way of handling it.
So, I wonder or am asking if there is any better or standard way to do it?
any help would be highly appreciated.
ThanksHi,
As you discovered, INTERSECT treats NULL as a value, but IN does not.
What you did with NVL is one way to handle the situation. If there was a chance that any of the columns could be NULL, then you might prefer something like this:
select *
from EMP
where ( EMPNO || '~' ||
ENAME || '~' ||
job || '~' ||
MGR || '~' ||
TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')
|| '~' ||
SAL || '~' ||
DEPTNO
) in (
select EMPNO || '~' ||
ENAME || '~' ||
job || '~' ||
MGR || '~' ||
TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')
|| '~' ||
SAL || '~' ||
DEPTNO
from emp
intersect
select EMPNO || '~' ||
ENAME || '~' ||
job || '~' ||
MGR || '~' ||
TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')
|| '~' ||
SAL || '~' ||
DEPTNO
from t
);This assumes that you can identify some string (I used '~') that never occurs in the strings in these tables.
This is implicitly converting the NUMBERs. That's usually not a good thing to do. but explicitly converting them would make this even more tedious.
You should explicitly convert any DATEs to strings, however. Depending on your default format, and your data, you might get away with implicit conversions even for DATEs, but don't bet on it.
If you had to do this often, you might consider writing a user-defined function:
delimited_string (empno, ename, job, mgr, hiredate, sal, deptno) would return a string like
'7839~KING~PRESIDENT~~17-NOV-1981~5000~10'
This will make the coding easier, but beware: it will make the execution slower. -
Showing navigation attributes in the same column of a query
Hi,
I would like to know if there is a way to define a query such that TWO navigation attributes that reference the same underlying characteristic can be displayed in the SAME column rather than TWO separate columns.
I will describe an example scenario to clarify the requirement. We are using a BI Content InfoCube (0COOM_C02) that has the navigation attributes 0COSTCENTER__0PROFIT_CTR and 0WBS_ELEMT__PROFIT_CTR activated. Both of these attributes reference the characteristic 0PROFIT_CTR. The InfoCube contains transaction data for Cost Centres and WBS Elements.
The requirement is to define a query that summarizes the data by profit centre. At the moment, in order to combine Cost Centre and WBS (Project) data in the same query by Profit Centre, both navigation attributes need to be selected, resulting in the following output:
0COSTCENTER__0PROFIT_CTR......0WBS_ELEMT__PROFIT_CTR......AMOUNT
PC01...............................................Not assigned...................................10,000
PC02...............................................Not assigned...................................20,000
PC03...............................................Not assigned...................................12,000
PC04...............................................Not assigned....................................2,000
Not Assigned....................................PC02..............................................5,000
Not Assigned....................................PC03..............................................8,000
Not Assigned....................................PC05..............................................30,000
Not Assigned....................................PC06..............................................50,000
However, the desired result is to display only one profit centre column using the two profit centre navigation attributes as shown below:
PROFIT CENTRE......AMOUNT
PC01..........................10,000
PC02..........................25,000
PC03..........................20,000
PC04............................2,000
PC05..........................30,000
PC06..........................50,000
Is there a way to achieve the above result using the two navigation attributes only, without having to add 0PROFIT_CTR as a characteristic to the InfoCube?
Any suggestions would be appreciated.
Thanks,
Mustafa.Hi Mustafa,
You have to use enhancement RSR00001 in the transaction CMOD to start developing your code.
For more information how the customer exit variables are processed, refer to the documentation:
http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm
A short example can be found here:
http://help.sap.com/saphelp_nw70/helpdata/EN/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm
This should help.
Regards,
Daniel -
Querying the schema for table name with column value!
In my schema i have 500+ tables and other objects.
i have a column with the name BO_PRODUCT_CODE.
I wants to know in what tables the value of BO_PRODUCT_CODE='FX03'.
i have query the user_tab_columns which gives me the result with 90 tables having the column BO_PRODUCT_CODE.
What is query which will give me the exact number/name of the table whose column value is FX03. ie, BO_PRODUCT_CODE='FX03'.Hi you can use this approach:
BEGIN
v_str VARCHAR2(250);
v_count NUMBER :=0;
DECLARE
FOR loop_tbl IN ( SELECT DISTINCT table_name FROM USER_TAB_COLUMNS
WHERE column_name ='BO_PRODUCT_CODE' )
LOOP
v_str := 'SELECT COUNT(*) FROM ' || loop_tbl.table_name || ' WHERE BO_PRODUCT_CODE=||'''' ||'FX03' || '''' '
EXECUTE IMMEDIATE v_str INTO v_count ;
IF v_count > 0 THEN
DBMS_OUTPUT.PUT_LINE ('Table Name :'|| loop_tbl.table_name || ' Count :'||v_count);
END IF;
v_count :=0;
END LOOP;
EXCEPTION
WHEN others THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
Please remove if any syntax error.
Regards -
How to query the sharepoint list with using lookup column
hi,
I have requrement like below
List A
Title Postionid(Lookup) PositionDescription
[email protected] 1
xxxx
[email protected] 1
xxx
[email protected] 1
xxx
[email protected] 2
sss
[email protected] 2
www
List B
Title fistname lastname age fathername
[email protected] x x 10 y
[email protected] p p 12 p
[email protected] q q 12
y
here in List A positionid is lookup column i have creating one visual web part i am querying the List A using query string as Positionid in that web part .finally what i want is i need date from list B on basis of corresponding position id here
List A Title and List B title are same i need each candidate info how can i do it
SrinivasHello,
Still you have not told that whether Position id is there in listB or not. Anyway if Poistion id is not there in list B then you have to use Title column of listA to gete data from ListB. Look at sample code below. It will first get data from ListA,
and use StringBuilder class to create dynamic CAML query because one Position id is having multiple values in listA.
query.Query = "<Where><Eq><FieldRef Name='Postionid' /><Value Type='Lookup'>1</Value></Eq></Where>";
SPListItemCollection items = list.GetItems(query);
if(items.Count > 0)
foreach(SPListItem item in items)
string strTitle = Convert.Tostring(item["Title"]);
//since listA is having multiple values for Postionid so you have to build a dynamic query here to get data from listB
//Refer link to build dynamic query
SPQuery listB = new SPQuery ();
query.Query = stringbuilder;
SPListItemCollection ListBitems = listB.GetItems(query);
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2dfe5fd6-e556-4132-a35c-e9f240360307/issue-with-caml-query?forum=sharepointdevelopmentlegacy
http://sharepoint.stackexchange.com/questions/69690/foreach-loop-inside-caml-query
Above links will help you to create dynamic query (in your case you need to use multiple <OR> operator in listB.
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Query Help Preserve Column Format
I have the following query that cast the ouput into colunms, my issues is that I need to extend the query to add the returned results of Connector_1, Cache_1, EPS_1, Sent_1, Condition_1.... ANy ideas how I can accomplish this preserving the same columns?
SELECT NodeName,
MAX(CASE WHEN Poller_Name='Connector' THEN CAST(Status AS varchar) ELSE '' END) Connector,
MAX(CASE WHEN Poller_Name='Cache' THEN CAST(Status AS varchar) ELSE '' END) Cache,
MAX(CASE WHEN Poller_Name='EPS' THEN CAST(Status AS varchar) ELSE '' END) EPS,
MAX(CASE WHEN Poller_Name='Sent' THEN CAST(Status AS varchar) ELSE '' END) Sent,
MAX(CASE WHEN Poller_Name='Condition' THEN CAST(Status AS varchar) ELSE '' END) Condition
FROM
SELECT
Nodes.Caption AS NodeName,CustomNodePollers_CustomPollers.GroupName As GroupName ,CustomNodePollers_CustomPollers.UniqueName AS Poller_Name, CustomNodePollerStatus_CustomPollerStatus.Status AS Status
FROM
((Nodes INNER JOIN CustomPollerAssignment CustomNodePollerAssignment_CustomPollerAssignment ON (Nodes.NodeID = CustomNodePollerAssignment_CustomPollerAssignment.NodeID))
INNER JOIN CustomPollers CustomNodePollers_CustomPollers ON (CustomNodePollerAssignment_CustomPollerAssignment.CustomPollerID = CustomNodePollers_CustomPollers.CustomPollerID))
INNER JOIN CustomPollerStatus CustomNodePollerStatus_CustomPollerStatus ON (CustomNodePollerAssignment_CustomPollerAssignment.CustomPollerAssignmentID = CustomNodePollerStatus_CustomPollerStatus.CustomPollerAssignmentID)
WHERE
(CustomNodePollers_CustomPollers.UniqueName = 'Connector') OR
(CustomNodePollers_CustomPollers.UniqueName = 'Cache') OR
(CustomNodePollers_CustomPollers.UniqueName = 'EPS') OR
(CustomNodePollers_CustomPollers.UniqueName = 'Sent') OR
(CustomNodePollers_CustomPollers.UniqueName = 'Condition')
AND
(CustomNodePollerAssignment_CustomPollerAssignment.InterfaceID = 0)
)A
GROUP BY NodeName, GroupNameThese values have similar data to what is being returned by the query above, I just want the results added to the relevant columns if I run the above query I get the result:
NodeName Connector
Cache EPS
Sent Condition
Node1 Connector1
1 0.1
123 Green
Theses are values that meet PollerName CASE and where clause I want to extend this so that the same/similar set of values can be returned for the PollerName
"Connector_1, Cache_1, EPS_1, Sent_1, Condition_1.... " to the same columns but if I add these to the case and where clause all I get is doubled up columns.
I was thinking of possibly pushing the results into a table unless there is an easier/better way? -
REPORT WITH CHANGING ITEM ON THE SAME COLUMN
Hi to all,
i'm trying to build a report with different item in the same column.
Is that possible in any way using other Oracle technique?
i'm not doing anything specific here, only i would like to know if the following possibility exist or not and how can i let apex render the htmldb_item fields 'dynamically'.
Using this CODE inside a PL/SQL function body returning sql query I obtain the following report content. Such the code of htmldb_item.fields is written, as a field value the HTML_ITEM is not rendered, so only the description of them appear in the report.
Does somebody know some tricks to make it work?
Thanx a lot
1 2 LAST_CALL htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,'dd/mon/yyyy') VALUE
21 1 AGE htmldb_item.text(4,FLD_VALUE,10,10) VALUE
create or replace FUNCTION FNC_GEN_GUI_ITEM(ITEM_TYPE NUMBER) RETURN VARCHAR2 AS
STRHTMLDITEM VARCHAR2(4000);
BEGIN
CASE ITEM_TYPE
WHEN 1 THEN STRHTMLDITEM:=' htmldb_item.text(4,FLD_VALUE,10,10) VALUE ';
WHEN 2 THEN STRHTMLDITEM:=' htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,''dd/mon/yyyy'') VALUE ';
END CASE;
RETURN STRHTMLDITEM;
END FNC_GEN_GUI_ITEM;
MY TABLE AS FOLLOWS:
CREATE TABLE "NEWPROJ"."DINFIELDGUI"
( "ID" NUMBER NOT NULL ENABLE,
"FLD_TYPE" NUMBER,
"FLD_NAME" VARCHAR2(4000 BYTE),
"FLD_VALUE" VARCHAR2(4000 BYTE),
CONSTRAINT "DINFIELDGUI_PK" PRIMARY KEY ("ID"));
Message was edited by:
Marcello NocitoHi to all,
i've solved, is very simple using decode inside the select:
SELECT
ID,
FK_HTMLDB_ITEM, DECODE(FK_HTMLDB_ITEM,1,HTMLDB_ITEM.DATE_POPUP(3,rownum,VAL,'dd-mon-yyyy'),2,HTMLDB_ITEM.TEXT(3,VAL)) VALORE
FROM TESTID
my table is:
CREATE TABLE "DEV"."TESTID"
( "ID" NUMBER NOT NULL ENABLE,
"FK_HTMLDB_ITEM" NUMBER,
"VAL" VARCHAR2(4000 BYTE))
Bye Bye -
Interactive Report - is there a way to find and change if necessary the unique column.
While creating an interactive report I accidently entered the wrong "unique column" on the sql query page. Is this a big deal and how can I find and change if necessary.
Query Builder
Link to Single Row View
Yes
No
Uniquely Identify Rows by
ROWID
Unique Column
Unique Column33ac2d45-960f-45af-acba-507f01d18e08 wrote:
Please update your forum profile with a real handle instead of "33ac2d45-960f-45af-acba-507f01d18e08".
While creating an interactive report I accidently entered the wrong "unique column" on the sql query page. Is this a big deal and how can I find and change if necessary.
Query Builder
Link to Single Row View
Yes
No
Uniquely Identify Rows by
ROWID
Unique Column
Unique Column
Yes. You can change this using the Uniquely Identify Rows by/Unique Column properties in the Link Column section on the Report Attributes tab of the interactive report definition. -
How to use the procedure column in reports
Hi all
How to call the procedure in reports as source.. If possible how to use columns of procedure in the layout column of report????Hi,
Your query is not clear.
1. In subject are you asking total column.
A. Edit pivot view and go to Rows and click Total BY option here you can find option like (none,before,after) the you can select after it will display total all culms.
2. I want use the columnC in columnD ? -- Am not understand.
A. What my understand is you want to see the report only C and D values only.
If it is correct we can apply filter in report level click column filed and apply not equal to A then it will show only C and D only.
If it is wrong pleas post me correct one with example. Will try to help out this.
I am not sure this is what your looking so far.
Award points it is useful.
Thanks,
Satya -
How can I get the real column of an alias in a view using system catalogs?
Given a view with columns that use aliases, I would like to get the real column name for the view column with the alias.
For example,
CREATE VIEW myView AS
SELECT name as col_1, price as col_2, price + 1000 as col_3
FROM myTable
I want to get that 'col_1' is actually the 'name' column and 'col_2' is the 'price' column by querying the system catalogs of SQL Server. It would be great to know whether I can resolve what 'col_3' is in the
example as well (i.e., when an alias is an expression, not just a column).
Thanks in advance.Or you can use the System function
sys.dm_exec_describe_first_result_set, example
CREATE TABLE myTable
(name varchar(30), price money);
GO
CREATE VIEW myView AS
SELECT name as col_1, price as col_2, price + 1000 as col_3
FROM myTable;
GO
SELECT name, source_table, source_column
FROM sys.dm_exec_describe_first_result_set(N'SELECT * FROM myView', NULL, 1) AS FRS
=>
Olaf Helper
[ Blog] [ Xing] [ MVP] -
How to fetch the Alias column values based on different column values?
Hello Gurus,
I have a table with the following struture -
"drop table T;
create table T(Name, Symbol, Amount,dep) as select
'Anderia', 'AA', 1050000,'HR' from dual union all select
'Michael', 'ML',150000,'Sales' from DUAL union all select
'Bill', 'BL', 1050000,'Finance' from dual union all select
'Nancy', 'NY', 4000,'HR' from DUAL union all select
'Anderia', 'AA',3000,'HR' from dual union all select
'Michael', 'ML',1050000,'Sales' from DUAL union all select
'Bill', 'BL', 1200000,'Finance' from DUAL union all select
'Anderia', 'AA', 1200000,'HR' from DUAL union all select
'Vish', 'VH', 1200000,'Marketing' from DUAL;"Ans try to find out the values of the column like
Name,symbol,dep,Amount,%Total,$Cumm Total, Rank but some additional columns like -
HR Amount, %HRTotal,$HR Cumm Total,
Finance Amount, %FinanceTotal,$Finance Cumm Total
Sales Amount, %SalesTotal,$Sales Cumm Total,
Marketing Amount, %MarketingTotal,$Marketing Cumm Total
then i am using the following query to fetch the Name,symbol,dep,Amount,%Total,$Cumm Total, Rank columns -
select name
, decode(grouping(symbol), 0, symbol, 'Total') symbol
, dep
, sum(amount) amount
, sum(per_total) "% Total"
, decode(grouping(symbol), 0, max(Cum_per_total), null) "% Cumm Total"
, decode(grouping(symbol), 0, max(rank), null) rank
from (
select name
, symbol
, dep
, amount
, per_total
, sum(per_total) over(order by rk) cum_per_total
, rank
, rk
from (
select name
, symbol
, dep
, sum(amount) amount
, round((sum(amount)/max(total_amount)) * 100,2) per_total
, dense_rank () over (order by sum(amount) desc) as rank
, row_number() over(order by sum(amount) desc) as rk
from (
select name
, symbol
, amount
, dep
, sum(amount) over() total_amount
, sum(amount) over ()
from t
group
by name, symbol, dep
group
by grouping sets((name, symbol, dep), ())
order by rank, max(rk) nulls lastBut i want to fetch the following columns as well.......how can i do it?-
HR Amount, %HRTotal,$HR Cumm Total,
Finance Amount, %FinanceTotal,$Finance Cumm Total
Sales Amount, %SalesTotal,$Sales Cumm Total,
Marketing Amount, %MarketingTotal,$Marketing Cumm Total
as i want all of the records, then going to specific to the dep.....do i need to use the case here?
Thanks for all of your time and effort in advanceHello Frank Kulash/Łukasz Mastaler,
Thanks for your time and effort.
I am using the Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
I am looking forward to have some additional columns (column alias) along with the the returned by the mentioned query - which are named as -
1- HR Amount
2- %HRTotal
3- %HR Cumm Total
4- Finance Amount
5- %FinanceTotal
6- %Finance Cumm Total
7- Sales Amount
8- %SalesTotal
9- %Sales Cumm Total
10 -Marketing Amount
11- %MarketingTotal
12- %Marketing Cumm Total
based on the logic like -
HR Amount = sum of amount case dep ='HR'
%HR Total = % of amount case dep ='HR'
%HR Cumm Total (cumulative % based on the cumulative total of %HR Total) = Cumm % of amount case dep ='HR'
similarly rest of the column........
Now how do i use case with a logic so that it returns me the columns as i want them ...using the above mentioned query .......
Kindly help me .....thanks in advance for all of your time -
How to query the database in an Entity Object (EO)
I am using JDeveloper 11.1.2.2.0
I am Forms developer working in a new ADF project and need some help from the ADF gurus, I am just a ADF beginner.
Maybe hits question has a easy solution, but I don't know how to implement this:
I have simplified my scenario, but this is what I Need to do:
One database table DBTABLE with 3 columns (C1,N1,D1) C1-varchar2; N1-Numeric; D1-Date.
In the DBTABLE I have the following data:
ONE; 10; 01/10/2012
ONE; 20; 02/10/2012
TWO; 15; 02/10/2012
ONE; 15; 03/10/2012
I have created an ADF EO for the DBTABLE with all 3 attributes, then I have created another transient numeric attribute T1.
My requirement is when I create a new record and set attribute C1=ONE the transient attribute T1 should show sum(N1) from DBTABLE where D1>= 01/10/2012 and D1 < 03/10/2012.
In this case when I create a new record should the shown in T1 a total of 10+20 = 30.
I know how to use the EOImpl getters and setters, and how to set the T1 attribute when C1 is set. My problem is how to calculate the total T1.
How can I implement this in ADF? It is possible to implement this in the EO? It is possible to make the query select sum(N1) from DBTABLE where D1>= 01/10/2012 and D1 < 03/10/2012 and return the value to the EO attribute?
Thank you in advanceHi Peter
Thank you for your suggestions, both of them are interesting but unfortunately they do not solve my problem, or at least I don’t know how.
I will try to better explain my problem
I have te table DBTABLE and another related table called DBDATES with colums(C1,DT1,DT2,TARGET) where I record periods of time and desired target. For instance my DBDATES table could have the following records
ONE; 01/01/2012; 31/01/2012; 100
ONE; 01/02/2012; 29/02/2012; 90
ONE; 01/03/2012; 31/03/2012; 95
TWO; 01/01/2012; 31/01/2012; 140
Exist a FK between both tables in the C1 column.
I have created an EO for the table DBTABLE with the tree persistent attributes (C1, N1, D1) an transient attribute (T1). The (C1,D1) is my DB primary key.
When I create a new record in the DBTABLE and based in the actual date I need to query the DBDATES table to check which is my TARGET and the valid target dates. For Instance if a record for person ONE is created on February 12, my TARGET is 90 from 01/02/2012 to 29/02/2012.
At the same moment I need to check the total amount of items record to the person ONE during the full target period.
Select sum(N1)
From DBTABLE
Where D1 between V2 and V3
And C1= V1;
Bind variables:
V1 = ‘ONE’;
V2 = ‘01/10/2012’ – queried from DBDATES
V3 = ‘03/10/201’ – queried from DBDATES
In resume, for a determined person when I create a new record in the DBTABLE I need to know their target for the actual period and how much as been record until now.
I don't know if is possible to solve this without using the View Objects, because I need to query the DBTABLE for a time frame and with bind variables.
Thank you in advance for your help.
Maybe you are looking for
-
15 inch Macbook pro w/o retina display or 13 inch Macbook pro with retina display?
Want to get a macbook for university. Going to be used primarily for work and casual use. Have a 32inch full hd tv to connect up to for watching movies etc, which is the better choice?
-
hi, friends, while Release billing SD document to accounting get the error Account 500010 requires an assignment to a co object. In G/L cost element category assign 11 no How can solved this error.
-
Looking for app: show # of files inside folder
Does anyone know of an app that will show the number of files contained inside a folder on the desktop? I'm looking for something along the lines of the new-mail indicator for the Mail dock icon. Thanks!
-
Hello: When I want to navigate a webpage that contains a flash object, the Internet Explorer show the icon that the page contains an error, if I relod the page, the page now doesn't show the error and the Flash objects work well. This occurs recently
-
Please tell me about Enhancement Techniques used in SAP Other then BADI/Usr
Hi Experts . Please guide me about Enhancement Techniques used in SAP apart from BADI/User-Exit . 1.) what is set and how to create it ? 2.) What is formula is SAP and How to set it for Enhancement Pupose . 3.) What is BTE (Buisness Transection Event