Regarding SQL query in OWB
Pls advice how can we use free hand sql query in an OWB job?
There must be a way other than mapping src tables and joiner , aggregator to target table. How to implement SQL sub-queries in OWB?
-Kuntala
OWB is all about creating a mechanical process that works fast, so you wouldn't really expect to enter ad hoc queries. What is the purpose of the project, and what problem is the freehand query meant to solve?
Similar Messages
-
Plugging a sql query into OWB.
Hi,
I have a complex Sql query which returns some records. I want to use this query in OWB. But i don't want to write any procedures or functions. Is there a way just to plug this code into OWB to run it.
vasuAny objection to putting the query into a view?
The only other possible way I can think of that might work would be to create an expression object, define your desired output columns in the output group, and then copy in your query per column as the defined expression for that column. (hardly the efficient option!). I think you might have to create some sort of dummy input for this to pass through the validation for expressions too (e.g. perhaps also use a constant defined as sysdate passed as an input to the expression, but then never referenced in the queries).
Can't say for sure if you can fool OWB into using your query in an expression object or not - but that would be the only way I can think of which might be possible to avoid using a view/function/procedure. -
URgent: Help regarding SQL Query
Hi ,
I need help regarding an sql query.
Sample Data:
ITEM_TYPE ITEM_NUM UNIT_PRICE QUANTITY LINE_TOTAL
ITEM 1 5 10 50
ITEM 2 10 5 50
ITEM 1 5 5 25
ITEM 2 10 20
TAX 16.5
TAX -3.5I would like to display the data as
ITEM_TYPE ITEM_NUM UNIT_PRICE QUANTITY LINE_TOTAL
ITEM 1 5 15 145
2 10 5
2 10
TAX 13.0
Line_total = unit_price * QuantityThanks in Advance
G.Vamsi Krishna
Edited by: user10733211 on Aug 5, 2009 7:42 AM
Edited by: user10733211 on Aug 5, 2009 7:49 AM
Edited by: user10733211 on Aug 5, 2009 8:12 AM
Edited by: user10733211 on Aug 5, 2009 8:22 AM
Edited by: user10733211 on Aug 5, 2009 8:24 AMHi,
Try this, use some analytics:
SQL> with t as (
2 select 'item' item_type, 1 item_num, 5 unit_price, 10 quantity, 50 linetotal from dual union all
3 select 'item', 2, 10, 5, 50 from dual union all
4 select 'item', 1, 5, 5, 25 from dual union all
5 select 'item', null, 2, 10, 20 from dual union all
6 select 'tax', null, null, null, 16.5 from dual union all
7 select 'tax', null, null, null, -3.5 from dual
8 ) -- actual query starts here:
9 select item_type
10 , item_num
11 , unit_price
12 , sum_qty
13 , case when sum_lt = lag(sum_lt) over ( order by item_type, item_num )
14 then null
15 else sum_lt
16 end sum_lt
17 from ( select item_type
18 , item_num
19 , unit_price
20 , quantity
21 , sum(quantity) over ( partition by item_type, item_num ) sum_qty
22 , sum(linetotal) over ( partition by item_type ) sum_lt
23 , row_number() over ( partition by item_type, item_num order by item_type, item_num ) rn
24 from t
25 )
26 where rn=1;
ITEM ITEM_NUM UNIT_PRICE SUM_QTY SUM_LT
item 1 5 15 145
item 2 10 5
item 2 10
tax 13
4 rows selected.
edit
And please use the code tag, instead of clunging with concats.
Read:
http://forums.oracle.com/forums/help.jspa
Edited by: hoek on Aug 5, 2009 5:15 PM
edit2
Also nulls for item_type:
ops$xmt%OPVN> with t as (
2 select 'item' item_type, 1 item_num, 5 unit_price, 10 quantity, 50 linetotal from dual union all
3 select 'item', 2, 10, 5, 50 from dual union all
4 select 'item', 1, 5, 5, 25 from dual union all
5 select 'item', null, 2, 10, 20 from dual union all
6 select 'tax', null, null, null, 16.5 from dual union all
7 select 'tax', null, null, null, -3.5 from dual
8 ) -- actual query starts here:
9 select case when item_type = lag(item_type) over ( order by item_type, item_num )
10 then null
11 else sum_lt
12 end item_type
13 , item_num
14 , unit_price
15 , sum_qty
16 , case when sum_lt = lag(sum_lt) over ( order by item_type, item_num )
17 then null
18 else sum_lt
19 end sum_lt
20 from ( select item_type
21 , item_num
22 , unit_price
23 , quantity
24 , sum(quantity) over ( partition by item_type, item_num ) sum_qty
25 , sum(linetotal) over ( partition by item_type ) sum_lt
26 , row_number() over ( partition by item_type, item_num order by item_type, item_num ) rn
27 from t
28 )
29 where rn=1;
ITEM_TYPE ITEM_NUM UNIT_PRICE SUM_QTY SUM_LT
145 1 5 15 145
2 10 5
2 10
13 13
4 rows selected.If you really need a space instead of nulls, then simply replace the nulls by a space....
Edited by: hoek on Aug 5, 2009 5:18 PM -
I have a column with values
Sample Data
EMPNO
=====
1
2
3
4
5
6
7
8
.I would like to display all the values of the column in a single row with multiple columns
I do not want to create any other objects. i require a single query.
Sample Output
col1 col2 col3 col4 col5 col6 col7 col8 ............
=======================================
1 2 3 4 5 6 7 8 ...............FYI i am using Oracle 9.2.0
Thanks in Advance
Edited by: user10733211 on Oct 7, 2009 5:38 AMHmm...
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>with tab
2 as
3 (
4 select 1 cola from dual
5 union all
6 select 2 from dual
7 union all
8 select 3 from dual
9 )
10 select *
11 from tab;
COLA
1
2
3
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>with tab
2 as
3 (
4 select 1 cola from dual
5 union all
6 select 2 from dual
7 union all
8 select 3 from dual
9 )
10 select sum(decode(cola,1,1,0)) col1,
11 sum(decode(cola,2,2,0)) col2,
12 sum(decode(cola,3,3,0)) col3
13 from tab;
COL1 COL2 COL3
1 2 3
Elapsed: 00:00:00.00
satyaki>
satyaki>decode can be used in much more complex case - i guess. ;)
Regards.
Satyaki De. -
hii All
I need help for pl/sql function.
I build a function for monthly attendance all employees.
but now i want to show all Sundays with 'S' and others respectively 'P' and 'A'.
Currently Sunday also shows 'A'
So please help
SQL queries ... like
SELECT DISTINCT AL.USERNAME,
CASE WHEN DAY1 =1 THEN 'P' ELSE 'A' END DAY1,
CASE WHEN DAY2 =1 THEN 'P' ELSE 'A' END DAY2,
CASE WHEN DAY3 =1 THEN 'P' ELSE 'A' END DAY3,
CASE WHEN DAY31 =1 THEN 'P' ELSE 'A' END DAY31
FROM
SELECT DISTINCT USERNAME, SUM(CASE WHEN
fromdt=TRUNC(L.LOGIN_DATE) THEN
1
ELSE
0
END) DAY1
,SUM(CASE WHEN
fromdt +1=TRUNC(L.LOGIN_DATE) THEN
1
ELSE
0
END) DAY2,
SUM(CASE WHEN
fromdt+30=TRUNC(L.LOGIN_DATE) THEN
1
ELSE
0
END) DAY31
FROM ( SELECT DISTINCT TRUNC(LOGIN_DATE)LOGIN_DATE ,USERNAME FROM FCDM_AUDIT_TRAIL_NEW WHERE
TRUNC(LOGIN_DATE) BETWEEN fromdt AND todt
-- to_date( login_date, 'dd-mom-yyyy') between to_date( fromdt, 'dd-mom-yyyy') and to_date( todt, 'dd-mom-yyyy')
) L
GROUP BY USERNAME
) AL;
how can i show matched Sundays and show with 'SUN' or 'S'
Regards
vij..Try this way:
SELECT USERNAME,
MAX(CASE WHEN to_char(fromdt,'d')='1' and fromdt=TRUNC(L.LOGIN_DATE) THEN 'S'
WHEN to_char(fromdt,'d')!='1' and fromdt=TRUNC(L.LOGIN_DATE) THEN 'P'
ELSE 'A') DAY1,
MAX(CASE WHEN to_char(fromdt+1,'d')='1' and fromdt+1=TRUNC(L.LOGIN_DATE) THEN 'S'
WHEN to_char(fromdt+1,'d')!='1' and fromdt+1=TRUNC(L.LOGIN_DATE) THEN 'P'
ELSE 'A') DAY2,
MAX(CASE WHEN to_char(fromdt+30,'d')='1' and fromdt+30=TRUNC(L.LOGIN_DATE) THEN 'S'
WHEN to_char(fromdt+30,'d')!='1' and fromdt+30=TRUNC(L.LOGIN_DATE) THEN 'P'
ELSE 'A') DAY31
FROM
(SELECT DISTINCT TRUNC(LOGIN_DATE) LOGIN_DATE,
USERNAME
FROM FCDM_AUDIT_TRAIL_NEW
WHERE TRUNC(LOGIN_DATE) BETWEEN fromdt AND todt
) L
Group by USERNAME
;Max
http://oracleitalia.wordpress.com -
Regarding SQL query performance
Hi,
I have two queries and want to check which one would give a better performance. Is there any way other than Explain Plan to do this ?tkprof ?
Cheers
Sarma. -
How can I use the Rownum/Customized SQL query in a Mapping?
Hi,
* I need to use a Rownum for populating one of the target field? How to create a mapping with Rownum?
* How can I use an Dual table in OWB mapping?
* Can I write Customized SQL query in OWB? How can I achieve this in a Mapping?
Thanks in Advance
KishanHi Niels,
As I'm sure you know, the conundrum is that Reports doesn't know how many total pages there will be in the report until it is all done formatting, which is too late for your needs. So, one classical solution to this problem is to run the report twice, storing the total number of pages in the database using a format trigger, and throwing away the output from the first run when you don't know the total number of pages.
Alternatively, you could define a report layout so that the number of pages in the output is completely predictable based upon, say, the number of rows in the main query. E.g., set a limit of one, two, ... rows per page, and then you'll know how many pages there will be simply because you can count the rows in a separate query.
Hope this helps...
regards,
Stewart -
Hi Friends,
Am using Oracle 10g DB - 10.2.0.3.0
I have some basic doubts regarding sql query execution by Oracle.
Say, Am executing a query from a toad/sqlplus session for the first time, it takes 10 secs then 1 sec and so on.
Same thing happens for every 15 minutes.(Any specific reason for this ??).
It takes more time when it executes first because of parsing and all those stuff but from then on it picks from the
shared pool right??.. How long will it be there in Shared Pool does Oracle maintain any specific time period to clear that query from shared pool memory. How does Oracle handle this.
Another thing is, say, I have a report query, I run this query monthly. What will be the execution time when I run this query each and every month. Will Oracle parse this query everytime I run. How do I improve the performance in this situation (May sound odd :)).
Regards,
MarlonSay, Am executing a query from a toad/sqlplus session for the first time, it takes 10 secs then 1 sec and so on.
Same thing happens for every 15 minutes.(Any specific reason for this ??).
It takes more time when it executes first because of parsing and all those stuff but from then on it picks from the
shared pool right??.. How long will it be there in Shared Pool does Oracle maintain any specific time period to clear that query from shared pool memory. How does Oracle handle this. Share Pool caches the SQL statement. So when you execute the same SQL for the second time it goes for a soft parse. But this is not the only reason for the query to execute faster the second time. The time difference between a soft parse and hard parse is very minimal. So it really does not matter unless you are executing the same query several number of times.
The thing that really matters is the Data Buffer Cache. That is the rows that are selected by your query are cached into the Data buffer that is available in the SGA. So for the next time when you run the same query the IO is reduced as the data is available in the memory and you don't have to go to your disk to get the data.
But the data in Data Buffer is not persistent, meaning it follows the FIFO rule. That is first in first out. When the Data Buffer is full the content of the buffer is removed in the FIFO order.
Another thing is, say, I have a report query, I run this query monthly. What will be the execution time when I run this query each and every month. Will Oracle parse this query every time I run. How do I improve the performance in this situation (May sound odd :)). Like the Data Buffer the Shared Pool is also maintained in the FIFO order. So if the query is still in the Shared Pool the query will be soft parsed else it will be hard parsed. But its very rare that you will have a query in your Shared Pool for a month. -
Hello All,
I have one problem regarding sql query.
I have one internal table which contains equnr and bis as fields. There are two database tables egerr and eastl. The structure for tables are as follows:
Fields for egerr:
equnr, bis, logiknr in which first two fields form key.
Field for eastl:
anlage, bis, logiknr in which all fields form primary key.
I want to select records from internal table which does not have record in eastl.
For the reference we can extract logiknr from egerr by using intarnal table and then use this logiknr to check entry in table eastl. but i want those equnr which are in internal table but not mapped in eastl.
I want the most efficient solution for this as there are many records.
Thanks..... and if you have any queries then let me know.
Jignesh.hi,
as per ur statement, u want the field equnr which exists in the internal table but not in eastl. now for comparing with eastl u will need to check for all the three fields as they form the key...
get data from egerr for matching equnr and bis in your internal table
i.e. assuming ur table is itab and itab_logiknr contains a single field logiknr
select logiknr from egerr
into table itab_logiknr
for all entries in itab
where equnr eq itab-equnr
and bis eq itab-bis.
now from this data (itab_egerr), compare the data with that in eastl for matching (or non matching) values of logiknr
assuming data from eastl lies in itab_eastl
select anlage bis logiknr from eastl into itab_eastl
for all entries in itab_logiknr
where logiknr eq itab_logiknr-logiknr.
for non matching entries u can select data from eastl which is not present in itab_eastl now....
(but mind you....since all fields of eastl form the key, u might not be getting the correct data) so if possible study ur scenario again and see if u can search the eastl table comparing all fields in the primary key)
try this....get back in case of any clarifications
hope it gives u some pointers...
regards,
PJ -
SQL query problem with sorting
Hi,
I have question regarding sql query . Right now I am getting the results like this if i use this sql query
select ID,Name,Desc,Priority from emp order by Priority ;
Priority is varchar field. I don't want to change the Priority field and cannot add a new column in the table. Because i don't have permission to do that.
ID Name Desc Priority
=============================================
234 paul paul desc Highest
3452 mike mike desc High
4342 smith smith desc Low
6565 kelly kelly desc Low
9878 nate nate desc Medium
3223 deb deb desc High
============================================
I need a query to get the results like that.
ID Name Desc Priority
=============================================
234 paul paul desc Highest
3452 mike mike desc High
3223 deb deb desc High
9878 nate nate desc Medium
4342 smith smith desc Low
6565 kelly kelly desc Low
============================================
If any one knows about this one, please let me know.
Thanks,
BalaYou are aware that there are differences in the SQL implementation between Sqlserver and Oracle? You could try something like this, if there's a INSTR function:
ORDER BY INSTR('Highest,High,Medium,Low,', Priority || ',')You may have to change the "Priority || ," to a "Priority + ','), if string concatenation is done differently in sqlserver. Don't know about the ('), maybe you need (").
C. -
Regarding Exceptions of a SQL query
Hi,
We have a problem regarding the sql query shown below:
select max(column1) into var1
from table1
where column2 = 100;
We don't have any rows in the table1 but we are not getting the "NO data exception" while executing the query in a procedure.
If we modify the query to
select column1 into var1
from table1
where column2 = 100;
then 'No data found' exception is raised.
Can you please let us the reason behind this.
Thanks in advance.
LakshmiCut from Oracle documentation
If a query with an aggregate function returns no rows or only rows with nulls for the argument to the aggregate function, the aggregate function returns null.
AVG
COUNT
GROUPING
MAX
MIN
STDDEV
Aggregate function don't return 'No datafound Exception" I believe....Correcte me if i am Worng
Ashok -
SQL Query of an OWB map (row based)
If I trace a session, execute an OWB map (row based), will the trace file contain the actual SQL query ?
The problem with me is that when I am executing this row -based OWB map, it is throwing me an error CursorFetchMapTerminationRTV20007 BUT ( plus taking a long time) when I am taking out the intermediate SQL insert query,it is working fine ( and also within a very short period of time)
Execution status = COMPLETE
message text = ORA-06502: PL/SQL: numeric or value error: character string buffer too small
message text = CursorFetchMapTerminationRTV20007
No. task errors = 0
No. task warnings = 2
No. errors = 1
Since this OWB map (Truncate Insert) is row based hence I cannot cannot get the back end query from the OWB generated pl/sql package so wondering if I trace the session, check the trace file, may be I will able to see the exact SQL query generated. But wanted to confirm the same.Yes, the actual SQL run in the session will be in the trace file.
-
Hi...
I need to write one single sql to get execution audit and map stating with all error details using all possible owb audit tables..
Am new to the technology..fresher..could any one help me out regarding this query.
Regards,
GauthamCheck this
find mapping of particular pf? -
Is it possible to override the look up SQL query in the Key Look Up Operator?
Suppose I want to run the following query
select customer, max(revenue) from CUSTOMER group by customer_id and then look up the customer id and get the max revenue from the look up and populate the target table.
Is it possible with a Key Look Up operator or we need to use an aggregator and join it with the main flow.You are spot on. Thats what I have experienced while working with OWB for the last couple of months.
1.The look up is actually a join. Dont understand then why it is called a look up. It should have been called a pseudo joiner.
2. The second irritating part is - there is nothing called a multiple look up match policy. If more than one records are matched,then the records loaded to the target are also increased. You dont have something called " Select first match " or "Select last match" etc etc.
3. You dont have the facility to override the look up query, which can at times be required and can be a very smart way of doing a mapping.
3. Due to this poor functionality of the key look up operator, I was myself compelled to split a single innocent looking mapping to two parts, which is painful.
An ETL tool having this kind of look up functionality, I am afraid is pathetic.
I am eager to see what changes they make in 10g R2 if at all.#
regards
-Arnab -
Issue in creation of group in oim database through sql query.
hi guys,
i am trying to create a group in oim database through sql query:
insert into ugp(ugp_key,ugp_name,ugp_create,ugp_update,ugp_createby,ugp_updateby,)values(786,'dbrole','09-jul-12','09-jul-12',1,1);
it is inserting the group in ugp table but it is not showing in admin console.
After that i also tried with this query:
insert into gpp(ugp_key,gpp_ugp_key,gpp_write,gpp_delete,gpp_create,gpp_createby,gpp_update,gpp_updateby)values(786,1,1,1,'09-jul-12',1,'09-jul-12',1);
After that i tried with this query.but still no use.
and i also tried to assign a user to the group through query:
insert into usg(ugp_key,usr_key,usg_priority,usg_create,usg_update,usg_createby,usg_updateby)values(4,81,1,'09-jul-12','09-jul-12',1,1);
But still the same problem.it is inserting in db.but not listing in admin console.
thanks,
hanuman.Hanuman Thota wrote:
hi vladimir,
i didn't find this 'ugp_seq'.is this a table or column?where is it?
It is a sequence.
See here for details on oracle sequences:
http://www.techonthenet.com/oracle/sequences.php
Most of the OIM database schema is created with the following script, located in the RCU distribution:
$RCU_HOME/rcu/integration/oim/sql/xell.sql
there you'll find plenty of sequence creation directives like:
create sequence UGP_SEQ
increment by 1
start with 1
cache 20
to create a sequence, and
INSERT INTO UGP (UGP_KEY, UGP_NAME, UGP_UPDATEBY, UGP_UPDATE, UGP_CREATEBY, UGP_CREATE,UGP_ROWVER, UGP_DATA_LEVEL, UGP_ROLE_CATEGORY_KEY, UGP_ROLE_OWNER_KEY, UGP_DISPLAY_NAME, UGP_ROLENAME, UGP_DESCRIPTION, UGP_NAMESPACE)
VALUES (ugp_seq.nextval,'SYSTEM ADMINISTRATORS', sysadmUsrKey , SYSDATE,sysadmUsrKey , SYSDATE, hextoraw('0000000000000000'), 1, roleCategoryKey, sysadmUsrKey, 'SYSTEM ADMINISTRATORS', 'SYSTEM ADMINISTRATORS', 'System Administrator role for OIM', 'Default');
as a sequence usage example.
Regards,
Vladimir
Maybe you are looking for
-
Loadrunner 11 and Adobe interactive forms
I'm currently on-site for SAP Italy and the client wants to use Loadrunner 11 to test a business process that requires Adobe interactive forms. eCATT is not acceptable to the client Can you advise me if the question about this being possible using Lo
-
HT3702 Purchase could not be completed
Cannot purchased...payment declined because not enough money inside my debit card. After topup... Still cannot purchase.... So how to settle up
-
My iphone keeps rebooting and i can't update it and i can't use it at all
So my iPhone started doing weird things so I did a full data clear from my settings, since then it just keeps rebooting whenever I try to unlock it, I can't use it at all, I tried to update it via iTunes, it said the update to iOS 8.1 + the system re
-
Create a job without sql job agent
Hi I want to create a job to exec stored procedure once in day with out using job agent. Is there anyway to do it? Thanks,
-
New set up of Tiger - airport error
I am trying to go through the initial set up of Tiger on a Macbook and I chose our wireless network (from all those available) and then am asked for the WEP key which I supply and I get an Airport utility error and cannot proceed.