Extracting Metadata using Common Table Expressions MSSQL
I have been using the below SQL query to extract subsets of the Metadata structure from several dimensions in HFM. The process works well and is simple/quick to develop and incorporate in existing processes. I am curious if anyone else has been using a similar query to extract subsets of HFM Structure directly from HFM or other approaches to extract a subset of HFM Structure.
/* The query starts with a "Top Parent" and will return all parent/child information below that member. For this example I want all the metadata for the c1 dimension so I am using the top most parent which by default has an ID of -1. You can look up and member's id in the "APP_DIM_Item" table and use that as the "Top Parent" for the query. It is possible to correctly extract only a subset of the overall metadata for each dimension.
WITH dim (ItemID, ParentID, Level)
AS
SELECT
el.ItemID
,el.[ParentID]
,0 AS Level
FROM [<APP>CUSTOMLAYOUT] el
WHERE ParentID = -1 -- The "Top Parent" -1 will extract all metadata
and lDimID = 1 -- Needed only for the custom dimensions.
UNION ALL
SELECT
el.ItemID
,el.ParentID
,Level + 1 as Level
FROM [ <APP>_CUSTOM_LAYOUT] el
INNER JOIN dim AS d
ON el.ParentID = d.ItemID
where el.lDimID = 1 -- needed for the custom dimensions
/* Once the structure is extracted to the temp dim table you can query back and
join to the Item table to add addtional memeber details. If you leave the query as
is you will only see the parent/child Unique ID and level informtaion.
-- Parent/Child ID Structure
SELECT * FROM dim
-- Parent/Child Label Structure
Select Dim.ItemID, Dim.ParentID, Dim.Level, Member.Label, Parent.Label
From Dim
inner JOIN <APP>CUSTOMITEM Member -- Member Detail
on Member.ItemID = dim.ItemID AND Member.lDimID = 1
inner JOIN <APP>CUSTOMITEM Parent -- Parent Detail
on Parent.ItemID = dim.ParentID AND Parent.lDimID = 1
Did you get a chance to look at this guide chapter 7?
[http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
Bashir Awan
Similar Messages
-
Using Common Table Expressions in BO Universe
Hi All,
How to use Using Common Table Expressions(CTE) in BO Universe ?
i created the stored procedure and tried to use it in universe but i'm not able to.
Request you to help me out with this.
Regards,
Ravichandra KDid you get a chance to look at this guide chapter 7?
[http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
Bashir Awan -
Create a view using common table expressions
I'm having trouble finding out if this is even possible in Oracle.
Here is what I'm trying to accomplish with my view. A subject takes a survey numerous times across numerous dates. Depending on the responses to different questions, that subject is marked as having a set disease or affliction. The view that I'm building collects the necessary answers for each survey into one place (the first common table expression), then in subsequent CTEs, I'm adding the disease classification when the responses to the needed questions match. Sometimes the requirements state that the survey can't already be positive for other diseases, meaning that I need to ultimately discount them when checking subsequent diseases (each disease is built using it's own CTE of which there are 13). I built the query which performs these tasks with no problems. It runs and gives the responses that I'm looking for.
The problem comes into play when I attempt to wrap the existing working query into a create view process. When I add CREATE OR REPLACE VIEW TESTENV.TESTVIEW AS ( and the ending ); after the query, it is giving me the error: ORA-32034: unsupported use of WITH clause.
Am I getting the error simply because I can't put CTE's into views, or is it because the syntax for putting CTEs into Views is different than a normal view build process? Also, in case it makes a difference, the version of Oracle I'm using is: Oracle 10g.
Thank you.Here is the view that I'm trying to build:
<pre class="jive-pre">
CREATE OR REPLACE VIEW GI_DEV.PAIN_COMP AS (
WITH gatheredQuestions AS (
SELECT
s.date_of_survey_id,
a.question_1 as A_1,
a.question_5 as A_5,
a.question_6 as A_6,
a.question_7 as A_7,
a.question_8 as A_8,
a.question_9 as A_9,
a.question_10 as A_10,
a.question_12 as A_12,
a.question_13 as A_13,
a.question_14 as A_14,
a.question_15 as A_15,
a.question_16 as A_16,
b.question_1 as B_1,
b.question_4 as B_4,
b.question_5 as B_5,
b.question_6 as B_6,
b.question_7 as B_7,
b.question_8 as B_8,
b.question_9 as B_9,
b.question_11 as B_11,
b.question_12 as B_12,
b.question_13 as B_13,
b.question_14 as B_14,
b.question_15 as B_15,
b.question_16 as B_16,
b.question_16a_a as B_16a_a,
b.question_16a_b as B_16a_b,
b.question_16a_c as B_16a_c,
b.question_16a_d as B_16a_d,
b.question_16a_e as B_16a_e,
b.question_16a_f as B_16a_f,
b.question_16b as B_16b,
c.question_1 as C_1,
c.question_2 as C_2,
c.question_3 as C_3,
c.question_8 as C_8,
c.question_9 as C_9,
c.question_10 as C_10,
c.question_11 as C_11,
c.question_11a as C_11a,
c.question_11b as C_11b,
d.question_1 as D_1,
d.question_2 as D_2,
d.question_3 as D_3,
d.question_4 as D_4,
d.question_5 as D_5,
d.question_5a as D_5a,
d.question_5b as D_5b,
d.question_5c as D_5c,
d.question_6 as D_6,
d.question_6a as D_6a,
d.question_6b as D_6b,
d.question_6c as D_6c,
d.question_6d as D_6d
FROM
new_date_of_survey s
LEFT OUTER JOIN new_section_a a on a.solid_visit_a_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_b b on b.solid_visit_b_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_c c on c.solid_visit_c_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_d d on d.solid_visit_d_id = s.date_of_survey_id
), functDyspepsia as (
SELECT
date_of_survey_id,
'Functional Dyspepsia' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (4, 5)
and g.A_5 in (3, 4, 5, 6)
and g.A_6 in (0, 2, 3)
and (g.A_7 in (0, 2) and g.A_8 in (0,2))
and (g.A_9 in (0, 2) and g.A_10 in (0, 2))
), IBSLower as (
SELECT
date_of_survey_id,
'IBS Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (3, 4, 5)
and g.B_4 in (2, 3, 4, 5, 6)
and 2 <= (CASE WHEN g.B_5 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN (g.B_6 in (3, 4, 5) and g.B_7 not in (3, 4, 5)) or (g.B_6 not in (3, 4, 5) and g.B_7 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN (g.B_8 in (3, 4, 5) and g.B_9 not in (3, 4, 5)) or (g.B_8 not in (3, 4, 5) and g.B_9 in (3, 4, 5)) THEN 1 ELSE 0 END)
), IBSUpper as (
SELECT
date_of_survey_id,
'IBS Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (3, 4, 5)
and g.A_5 in (3, 4, 5, 6)
and 2 <= (CASE WHEN g.A_6 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN (g.A_7 in (3, 4, 5) and g.A_8 not in (3, 4, 5)) or (g.A_7 not in (3, 4, 5) and g.A_8 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN (g.A_9 in (3, 4, 5) and g.A_10 not in (3, 4, 5)) or (g.A_9 not in (3, 4, 5) and g.A_10 in (3, 4, 5)) THEN 1 ELSE 0 END)
), abMigraine as (
SELECT
date_of_survey_id,
'Abdominal Migraine' as pain_type
FROM gatheredQuestions g
WHERE
g.B_16 in (3, 4, 5)
and 2 <= ((CASE WHEN g.B_16a_a = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_b = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_c = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_d = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_e = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_f = 2 THEN 1 ELSE 0 END))
and g.B_16b = 2
), lowerFunctAbPainSyndrome as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain Syndrome - Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (4, 5)
and g.B_4 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
and
((g.B_15 in (2,3,4,5) and 2 > ((CASE WHEN g.B_11 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_14 in (2,3,4,5) THEN 1 ELSE 0 END)))
or (g.B_15 not in (2,3,4,5) and 2 <= ((CASE WHEN g.B_11 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_14 in (2,3,4,5) THEN 1 ELSE 0 END))))
), upperFunctAbPainSyndrome as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain Syndrome - Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (4, 5)
and g.A_5 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
and
((g.A_16 in (2,3,4,5) and 2 > ((CASE WHEN g.A_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_14 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_15 in (2,3,4,5) THEN 1 ELSE 0 END)))
or (g.A_16 not in (2,3,4,5) and 2 <= ((CASE WHEN g.A_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_14 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_15 in (2,3,4,5) THEN 1 ELSE 0 END))))
), lowerFunctAbPain as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain - Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (3, 4, 5)
and g.B_4 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper union select date_of_survey_id from upperFunctAbPainSyndrome union select date_of_survey_id from lowerFunctAbPainSyndrome)
), upperFunctAbPain as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain - Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (3, 4, 5)
and g.A_5 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper union select date_of_survey_id from upperFunctAbPainSyndrome union select date_of_survey_id from lowerFunctAbPainSyndrome)
), functConstipation as (
SELECT
date_of_survey_id,
'Functional Constipation' as pain_type
FROM gatheredQuestions g
WHERE
2 <= ((CASE WHEN g.C_1 in (0, 2) THEN 1 ELSE 0 END) + (CASE WHEN (g.C_2 in (2,3) and g.C_3 <> 2) or (g.C_2 not in (2, 3) and g.C_3 = 2) THEN 1 ELSE 0 END) + (CASE WHEN g.C_8 = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.C_9 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN g.C_10 = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.C_11 in (4, 5, 6) THEN 1 ELSE 0 END))
and date_of_survey_id not in (select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
), fecalIncontinence as (
SELECT
g.date_of_survey_id,
'Nonretentive Fecal Incontinence' as pain_type
FROM
gatheredQuestions g
left outer join new_date_of_survey s on s.date_of_survey_id = g.date_of_survey_id
left outer join new_demographics d on d.solid_demographics_id = s.demo_id
WHERE
4 <= trunc((months_between(s.survey_date, d.date_of_birth))/12)
and g.C_11 in (4, 5, 6)
and g.C_11a in (2, 3)
and g.C_11b in (3, 4, 5, 6)
and g.date_of_survey_id not in (select date_of_survey_id from functConstipation)
), aerophagia as (
SELECT
date_of_survey_id,
'Aerophagia' as pain_type
FROM gatheredQuestions g
WHERE
2 <= ((CASE WHEN (g.D_1 in (3, 4, 5) and g.D_2 not in (3, 4, 5)) or (g.D_1 not in (3, 4, 5) and g.D_2 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN g.D_3 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN g.D_4 in (3, 4, 5) THEN 1 ELSE 0 END))
), cycVomitSyndrome as (
SELECT
date_of_survey_id,
'Cycllic Vomiting Syndrome' as pain_type
FROM gatheredQuestions g
WHERE
g.D_5 in (4, 5)
and g.D_5a in (3, 4, 5, 6)
and g.D_5b = 2
and g.D_5c = 2
), adolRumSyndrome as (
SELECT
date_of_survey_id,
'Adolescent Rumination Syndrome' as pain_type
FROM gatheredQuestions g
WHERE
g.D_6 in (4, 5)
and g.D_6a = 2
and g.D_6b = 0
and g.D_6c = 0
and g.D_6d = 0
), gatheredPains as (
+
select * from functDyspepsia
union
select * from IBSLower
union
select * from IBSUpper
union
select * from abMigraine
union
select * from lowerFunctAbPainSyndrome
union
select * from upperFunctAbPainSyndrome
union
select * from lowerFunctAbPain
union
select * from upperFunctAbPain
union
select * from functConstipation
union
select * from fecalIncontinence
union
select * from aerophagia
union
select * from cycVomitSyndrome
union
select * from adolRumSyndrome
SELECT
date_of_survey_id,
string_agg(pain_type) as PainType
FROM gatheredPains
GROUP BY date_of_survey_id
</pre>
I tried remove the leading and ending parenthesis, and ended up getting the error that it is missing the select keyword. When I take the create view step out of this, the query builds with no problem, so I know that it's not missing a select or that it isn't in the correct place.
Thank you for all your help so far. -
Using Common Table Expressions (CTE) in a DSV Named Query
Hi,
I have a scenario where I need to "generate" fact data, so I'm using a CTE to generate the data. For maintainability reasons I have this CTE declared inside a view and in the DSV Named Query I just have a SELECT * FROM FactView.
This works fine as long as the recursion level falls within the default limit of 100. If it does not, I have to specify the maximum recursion level such as:
SELECT *
FROM FactView
OPTION (MAXRECURSION 0)
The problem is I can't specify the Named Query like this. As explained elsewhere my query is embeded as a subquery and the OPTION keyword cannot be used in a subquery.
Is there any other way I can specify the maximum recursion level on a Named Query?Load your fact table data into staging table and then process fact using direct load from staging table.
-
Memory usage Common table Expressions
Hope view will use temporary memory while using it.. and
If I use Common table Expressions (with <datsetname> select query )
in stored procedure instead of view will it use the temp memory ?
Many thanks
KalingaWhy would it be any different? Its still a query. It will use any memory available for sorting
(defined by sort_area_size)
and if it exceeds this it will use the temporary tablespace.
If their is more than one temporary tablespace , it will use the temporary tablespace which that user has been assigned. -
Hi,
In DB2, there is a concept called 'common table expressions'.
A common table expression is like a temporary view that is defined and used for the duration of an SQL statement. You can define a common table expression for the SELECT, INSERT, and CREATE VIEW statements. Each common table expression must have a unique name and be defined only once. However, you can reference a common table expression many times in the same SQL statement.
Eg :--
insert into test1 with test_view1(column2) as (select colum1 * 2 from test2) select column2 from test_view1;
Here 'test_view1' is a temporary view created with a select statement. This view has the scope only within this SQL statement. The data inserted into the table 'test1' is selected from the temporary view.
This can be achieved in Oracle by creating views and then using the INSERT .. SELECT statement. But I like to know whether any direct equivalent available for this in Oracle, something like 'INSERT .. WITH <view_name>' as in DB2.
Please advise,
Thanks,
SmithaEr...you mean like this?
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
SQL> INSERT INTO emp
2 WITH v_emp AS
3 (SELECT empno + 1, ename, job, mgr,
4 hiredate, sal, comm, deptno
5 FROM emp)
6 SELECT *
7 FROM v_emp;
14 rows created.
SQL> No, nothing like that whatsoever. -
Datatypes in a recursive common table expression
I'm trying to use a (recursive) common table expression to generate a list of dates. The following code is working fine with 11.2
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, DATE '2005-02-01' + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I would like to avoid repeating the start date in the recursive part, and I tried the following:
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, d.dt + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I get the following error: ORA-01790: expression must have same datatype as corresponding expression
Now from my understanding the datatype should be DATE for both parts of the UNION.
I also tried it with d.dt + interval '1' day but that produces the same error message. using to_date() instead of the ANSI date literal does not change it either.
What am I missing here?castorp wrote:
I'm trying to use a (recursive) common table expression to generate a list of dates. The following code is working fine with 11.2
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, DATE '2005-02-01' + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I would like to avoid repeating the start date in the recursive part, and I tried the following:
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, d.dt + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I get the following error: ORA-01790: expression must have same datatype as corresponding expression
Now from my understanding the datatype should be DATE for both parts of the UNION.
I also tried it with d.dt + interval '1' day but that produces the same error message. using to_date() instead of the ANSI date literal does not change it either.
What am I missing here?http://www.orafaq.com/forum/mv/msg/95011/463394/102589/#msg_463394 -
What happens to unused common table expressions ,Does this affect in performance or ?
If I write a query with one or more common table expressions to which I
don't actually refer in the query, do they just get pruned off or do
they get executed regardless? how does it affect in performance
Prem ShahTry below
seems when the CTE is not refer in the query then statement inside CTE is not executing at all even if it nested CTE, see for your self
Create table UserInfo
UserId int primary key,
UserName varchar(30)
GO
Create table UserInfo1
UserId int primary key,
UserName varchar(30)
GO
insert into UserInfo
select 1001,'X1' union all
select 1002,'X2' union all
select 1009 ,'X9'
GO
insert into UserInfo1
select 1001,'X1' union all
select 1002,'X2' union all
select 1009 ,'X9'
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
Begin tran
select * from UserInfo1 where UserId between 1001 and 1009
and UserName = 'XXXX'
--Commit
PRINT 'WITH out CTE access in select'
SET STATISTICS IO ON
;WITH CTE1 AS
(Select * From UserInfo1)
select * From UserInfo
PRINT 'WITH CTE access in select'
;WITH CTE1 AS
(Select * From UserInfo1)
select * From UserInfo a inner join CTE1 b on a.UserId=b.UserId
Stats IO
WITH out CTE access in select
(3 row(s) affected)
Table 'UserInfo'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
(1 row(s) affected)
WITH CTE access in select
(3 row(s) affected)
Table 'UserInfo1'. Scan count 0, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'UserInfo'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
(1 row(s) affected)
Thanks
Saravana Kumar C -
How can I extract metadata using JMF
Hello, I want to extract metadata such as artist, pulisher, name, author
, etc. from media files. Can Java Media Framework do? Personally, I did
not find any APIs from JMF Javadoc.
thank youplease help me, thanks :)
-
Can i use create function for MSSql scalar and table valude function.
Hi,
1) Can i use create function for MSSql scalar and table valued function?
2) How many type of user defined function are there in oracle 11g express?
3) And can i reture any "type" form user defined function?
yourse sincerely944768 wrote:
Q1)That means even if i return predefined types like integer, varchar2 then also PGA is used ?The data type does not determine where the variable is stored. A string (called a varchar2 in Oracle) can be stored in stack space, heap space, on disk, in a memory mapped file, in a shared memory, in an atom table, etc.
It is the who and what is defining and using that string, that determines where and how it is stored.
The Oracle sever supports 2 languages in PL/SQL. The PL (Programming Logic) language is a procedural/declarative language. It is NOT SQL. SQL is integrated with it. The PL/SQL engine uses private process memory (PGA). So PL/SQL variables exist in the PGA (but there are exceptions such as LOBs).
Q2) So please suggest me solution in oracle.Sounds to me you are looking at how to implement a T-SQL style function as an Oracle function, and once implemented, do joins on the function.
Do not use PL/SQL in SQL in place of a SQL select. It is not T-SQL.
One cannot use PL/SQL to create functions along the style of T-SQL, where the function executes a SQL using some conditional logic, and then return as if the function was a native SQL select.
T-SQL is an extension to the SQL language - making it a hybrid and very impure language implementation. PL is based on ADA - part of the Pascal family of languages. The E-SQL (embedded SQL) approach used in languages like C/C++, Cobol and Ada, has been transparently done in PL/SQL. You can write and mix PL code and variables with SQL code. And the PL/SQL engine figures out how to make the call from the PL/SQL engine to the SQL engine.
But PL/SQL is not "part" of the SQL language and does not "extend" the SQL language in a T-SQL fashion.
So you need to check your SQL-Server preconcepts in at the door, as they are not only irrelevant in Oracle, they are WRONG in Oracle.
The correct way in Oracle, in a nutshell - Use the SQL language to do data processing. Use PL/SQL to manage conditional process flow and the handling of errors. -
How to use Table valued MSSQL function in OBIEE
Hi all,
Can some one help me to understand how to use table valued function in OBIEE? I want to use a table valued function (MSSQL function, with some input parameter), in the physical layer to pull the data?
I know for MSSQL Stored Procedure we can write as
EXEC SP_NAME @Parameter = 'VLUEOF(NQ_SESSION.Variablename)'
but now I have a table valued function in the query window I can get the data as
select * from myfunction(parametervalue)
In physical layer of OBIEE I have tried as
select * from myfunction('VLUEOF(NQ_SESSION.Variablename)'), but I'm getting error as the NQ_SESSION variable doesn't have a value , but actually I have initialized the variable but still Im getting error.
Can some one help me to solve this.
Thanks,
MithunFollow this link and try yourself. let me know for issues
Substring instr issue in obiee
Appreciate if you mark
Edited by: Srini VEERAVALLI on Feb 20, 2013 8:13 AM -
Need code for Generic Extraction using FM using multiple tables.
Hi Experts,
We are doing a generic functional module extraction based on four tables - say,
Table TT1 u2013 with fields AA, BB.
Table TT2 u2013 with fields CC, DD.
Table TT3 u2013 with fields EE, FF.
Table TT4 u2013 with fields GG, HH.
The value of the field BB = DD.
The value of the field DD = FF.
The value of the field FF = HH.
The key field with which we have to extract data is AA.
We have created a structure for the above tables u2013 say STR containing all the fields from the above tables.
Now as such all the data from the tables is in the internal table ITF.
This data from the internal table is passed to the structure STR.
Somewhere, I think we are making a mistake. I do not know where.
When we check the datasource extraction in RSA3, we find that there is data only from the Table TT1. Data from other tables does not populate in the datasource.
We do not know where we went wrong.
Kindly help us.
Thanking you all in advance.
With Kind Regards,
Shreeem.Hi,
You will have to use the select query with joins as given in the below example,
SELECT pcarrid pconnid ffldate bbookid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( spfli AS p
INNER JOIN sflight AS f ON pcarrid = fcarrid AND
pconnid = fconnid )
INNER JOIN sbook AS b ON bcarrid = fcarrid AND
bconnid = fconnid AND
bfldate = ffldate )
WHERE p~cityfrom = 'FRANKFURT' AND
p~cityto = 'NEW YORK' AND
fseatsmax > fseatsocc.
But I would suggest you to better create a Data base View with all the required tables and then use that view for data selection in your FM.
Regards,
Durgesh. -
Loading metadata into EPMA applications using Interface tables-Automation
Hi,
I am loading the metadata into epma applications using interface tables as ODI dont perit to load metadata into epma applications. Is there any way of using ODI and interface tables together to load the metadata
This process also need to be automated.Hi,
It is certainly possible and has be done, though there is not anything available that will do it for you, you will have to put in some effort learning the structure of the interface tables, then build interfaces and then a package in ODI to streamline the process.
Cheers
John
http://john-goodwin.blogspot.com/ -
Extracting data from multiple tables using DB connect
Hi,
I am having different tables which are having the same structure in oracle database but there names are different.Now i have only one datasource at BI side.This datasource shld extract data from the tables dynamically.How can i do it using DB Connect .
Thnxsahh I see - problem as you said then is if you then take on a new location!
I would then put into the source system a table identifier and create a view across all the tables
Then dbconnect from the view and use the selection parameter of table parameter if you wanted one infopackage per "location"
If you do need to have a new table in the source then just expand the view and create a new ipak
hence NO bw changes required that need a dev-q-p transport - just the ipak in prod and it;s the source systems problem to add the extra table to the view -
Extract Data Using SQL Expression
Hello, I've created a staging table and just realized that I need some new extra fields.
Should I create them in the stage or in the target table?
I want to use the SQL expression COUNT so to fill these new fields with edited source data,
but don't know exactly how to do it. I am a bit amateur.
Thank you.I' ve just realized that I am reading your book! Oracle Warehouse Builder 11gR2: Getting Started 2011.
What If I need the rest of the fields not to be changed? Fields like Name or whatever.I can't figure it out. Thanks again.
For example, I have these two fields Name and Date and I want to use the count expression through the aggregation operator for the Date field and create a new field Quantity to store the reaults. But I need the field Name to remain intact.
How can I manage this? Thank you.
Edited by: 928543 on 11 Ιαν 2013 1:35 μμ
Edited by: 928543 on 11 Ιαν 2013 1:44 μμ
Maybe you are looking for
-
Problems providing files for print on an A4 page?
Hi, I have created a small book with pages of an average size of A5. I exported it to PDF and put on crop marks etc and sent it off to my printer. However, they say they need the pages with crop marks on A4 pages (not scaled up, just the A5 page ba
-
Null Pointer Exception while Retrieving Records using Java API
Hi, I am using the Class RetrieveLimitedRecords, to retrieve he records from the main table. While using this class I am getting an error Null Pointer Exception, when there are no records matching the search criteriea. Could anybody tell me how t
-
Cannot install office 2008 on new Macbook pro.
I have just received my new macbook pro 17 inch. I"ve installed the bundled apps cd, but when I try to install Mac Office 2008, I receive the following error: Microsoft office for Mac can't be installed on this disk. newer-version-installed message.
-
Am I able to change my email for BlackBerry id?
Hi I was wondering if I can change my email for my BlackBerry I'd on my Q5? Its because my email was hacked so I have to close it. Anyways hoping I can change it. Thanx
-
My ipod won't sync correctly!!
i used home sharing and while my ipod was syncing it came unplugged and now it won't sync anymore what can i do?