Table Functions, Direct Database Requests, and NUMBER data types

Hello. I call a number of table functions from our BI Enterprise server, and I've elected to do so using Direct Database Requests (I believe you can also call table functions in the physical layer of the repository, but that's not what I'm doing). The problem is that whenever I return any number from the table function that is not a whole number (1.23, for example), BI assigns the INTEGER datatype to the field instead of the DOUBLE datatype, thereby rounding my number to the nearest integer. Here's a concise example:
Create these 3 database objects:
CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER);
CREATE OR REPLACE TYPE my_tab AS TABLE OF my_row;
CREATE OR REPLACE FUNCTION my_table_function RETURN my_tab
PIPELINED IS
BEGIN
PIPE ROW(my_row(1.23));
END;
Then make this your query in your Direct Database Request:
SELECT my_num FROM table(my_table_function);
That query correctly returns "1.23" when it's called from the database. In BI, on the other hand, it returns "1" (and labels the field an INTEGER instead of DOUBLE data type). If in the Direct Database Request you change the Column Properties ->Data Format -> Decimal Places from 0 to 2, it then not surprisingly displays "1.00". I then tried changing MY_ROW.MY_NUM's datatype by explicitly specifying precision, and no luck. BI still labels this field as an INTEGER. Then I started trying to trick BI by massaging the SQL statement itself. None of the following worked:
SELECT to_number(my_num) as my_num2 FROM table(my_table_function);
SELECT my_num2 + 0.01 as my_num3 FROM (SELECT my_num - 0.01 AS my_num2 FROM table(my_table_function));
SELECT to_number(to_char(my_num)) as my_num2 FROM table(my_table_function);
SELECT to_number(substr(to_char('x'||my_num),2)) as my_num2 FROM table(my_table_function);
Now I did find a solution, but I'm surprised that I have to resort to this:
SELECT * FROM (SELECT /*+ NO_MERGE */ my_num FROM table(my_table_function));
Does anyone out there know of a better way to do this? The above is a hack in my opinion. :)
Thanks in advance for any input.
-Jim

Yes, it's really amazing.
But I got it.
CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER(10,2));and in your SQL :
SELECT cast(my_num as double precision) as my_num2 FROM table(my_table_function);I have the good result and I see the numbers after the comma.
Very tricky !
Edited by: gerardnico on Jul 7, 2009 2:55 PM change number(10,2) by double precision ......... pfffff

Similar Messages

  • Direct Database Request - Incorrect Column Data type

    Hello All -
    hope you can help with this. I'm using the Direct Database Request in Oracle BI to send a complex query directly to our data warehouse. My problem is that the result columns containing my measures are converted to integer by Oracle BI when they should be double. The integer conversion causes decimal values to be rounded, reading to incorrect results in my reports. I've tried several tweeks to my query in an attempt to allow OBIEE to make the correct guess on the data type but nothing has worked.
    Is there a way to force OBIEE to recognize the correct data type for a column in a Direct Database Request Query?
    Thanks in advance for you help!
    Mac

    Thank you both.
    David's response was helpful from a style/readability perspective (the columns in question were complex expressions) but I had already attempted the approach and it hadn't solved the formatting issue. Nico's response solved the problem.
    Regards,
    Mac

  • Direct database request and session variable value

    Hi,
    I have a problem by doing the following : idea is to have report with a list of all tables in user schema (which are not all in repository physical layer).
    By clicking on the name of any, should bring answer report which is done as direct database request doing basically select * from table_clicked (this will be basically the same table with sufix _err holding error rows).
    What I'm trying to do is having some kind report for error rows which can be in different tables in my database. So i had in mind to construct name of table i need , and pass it to database request through session variable. Am i doing right by doing direct database request like this :
    select * from 'VALUEOF(NQ_SESSION.TestVar2)'
    Is there another easyer way of doing this? I know this can be done by gourl by passing parameters but not sure how when i can't filter columns in direct database request (this can be different tables with different names of columns). I hope i didn't complicated this too much.
    Thnx in adwance

    Hi,
    I know this is a hack, and would be much more easy to create one table with dimension and measures, but this is intended to be used with code generator, which can produce different error tables with different column names in different time: It is not conviniet for somebody to add them to repository every 5 minutes. For example : i run my workflow and for first run I have errors in table1(let us say customer table with 30 columns) and if click on the table name in some answer report, i want to see all the bad records in the table. Tomorrow after the run, there are bad records in table1 and in table2 (lets say products) so I would have choice to pick table 1 or table2 and see al the bad records in any of these tables. This means that I can not now which tables will I have tomorrow, and as it is generic, I can manually add some tables in my model, and would have to add err table also as a possibility to have error rows?
    I saw post saying that you can pass parameter value by using go url functionality, by modifying configinstance file, but didn't suceed - http://gerardnico.com/wiki/dat/obiee/logical_sql/obiee_session_variable_go_url . Maybe some mistake or any better solution? I created session variable TestVar2, also modified instanceconfig.xml by adding this before </ServerInstance>
    <ParamList>
    <Param name="NQ_SESSION.TestVar2" source="url" nameInSource="SETVAR"/>
    </ParamList>
    and used go url in column formula : ''||"Physical Targets"."Physical Table"||''
    Can I use @1 for using first column value?
    Thnx

  • Direct Database Request Error: illegal number at oci

    Hello, all.
    In Oracle BI Answers i get an error by building an direct database request: illegal number at oci.....
    The reason of error is in expression to_char((date_1-date_2)*24, '9990.99')
    The error disappears if i write expression to_char((date_1-date_2)/*24*/, '9990.99')
    BI doesn`t understand multiplying in SQl request?

    Hi,
    Couple of suggestions :
    1) Run your direct database queries in a SQL editor (SQL Developer, TOAD, SQLplus) etc to confirm the query runs OK - be carefull with Toad or SQL Dev - you want to return the entire dataset, not just the first xxxxK rows these tools tend to bring back, they sometimes hide the problem 'row' which maybe is causing the error.
    2) Once the error is returned via straight up SQL , maybe try the database / SQL forum as your problem I think lies there, not with the BI Server.
    3) My one stop shop for Oracle date arithmetic : http://www.akadia.com/services/ora_date_time.html
    4) assuming the SQL returns correctly, report back to us so we can help with OBIEE specific issues !
    what time period are you trying to bring back between your date 1 and date 2 ?
    Hope this helps a little,
    Alastair

  • Applying Prompt on Direct Database Request in OBIEE 11g

    Hi
    I am creating Analysis by using 'Direct Database Request' and i am executing SQL Query to direct Database i am NOT creating Business and Presentation Model in RPD. Now i have to apply Filters on Report. any idea how i can do that?
    Example:
    Prompt (filter) :   Year                 Employee Department
                              2011                    HR
                              2012                    IT
                              2013                    Finanical
    Employee Name |    Employee Age   | Gender  | Leave Status     |    Leave Type
    abc                            31                      male       on leave              Sick leave
    xyz                             39                    Female    on leave               Annual leave
    i want to filter by YEAR and Employee Department.
    Regards
    Baig

    NO!!!!!!!!!!
    You Direst SQL query should contain the url
    ex:
    SELECT COL1,COL2,
    '<a href=http://obiapps:9704/analytics/saw.dll?Go&Path=/Answers&path=%2Fshared%2FAppslink%20Dashboards%2F_portal%2FAppslink%20Dashboards%2FEmployee%20Department=Navigate&P0='+BUSINESS_GROUP_NAME+' target=_new>'+BUSINESS_GROUP_NAME+'</a>
    FROM TABLE
    then go for the column format
    Note: in MS SQL + is for concat, you might have to change based on your db.

  • Direct Database Request - Add Drop Down List

    Hi,
    I have created a direct database request and would like to represent the output in table format. How can I add a page drop down filter, I would like to move two columns as page drop down lists and also be able to view the columns in the table.
    I know how to acheive this with a pivot table, but can this also be done with a table layout?
    Thanks

    Here is the answer to your specific question: No, you can't do "page drop downs" in Table View. You will have to use Pivot Table as described in previous posts.
    You will have to use dashboard prompts to get your choices. You are probably saying, "but dashboard prompts must be built on a Subject Area column and I can't select it because I am using a direct database as my source. So how do I create the prompt?"
    Good question. My question is, on the columns that you need as the "drop down filters," are those columns in any existing Subject Area? I know that your request is built by direct database, but if the specific column you need for your dashboard prompt can be found in a Subject Area, then you can use that Subject Area on which to build your dashboard prompts.
    You can add a WHERE condition in your direct database to receive the presentation variables. Read below to learn how:
    http://108obiee.blogspot.com/2009/11/variables-in-direct-database-requests.html

  • Using Filters in Direct Database Request

    Hi,
    I am creating my report table using direct database request option. Now i want to filter the column values. But in Direct Database Request report OBIEE is not giving option for filtering i.e. filter Add Filter button is not visible. How can i do it?
    Thanks
    Aasim Khan

    Actually i can not hard code these values in my SQL. I am using variables in my SQL to give where clause condition. But how can i set these variables? The actual scenario is that i have a report table. When i clicked some column of this report i have to navigate to another report and pass some value of clicked row to the next report. On the next report SQL i have defied a variable in my where clause. But i am unable to set this variable when i clicked on some row link. So how can i achieve it in direct database request report?
    In normal answer report all values of the clicked report are passed to the next report, and in the next report we mention filters with "is prompted" option to apply the selected values. But in Direct Database Request report we do not have this filter option. So can anybody explain how can i update variable values in the above mentioned scenario.
    Thanks,
    Aasim Khan.

  • Drill down on direct database request

    Hi all,
    I would like to know if its possible to drill down in a table created with a direct database request. I've created the direct request and run it perfectly, but drilling down is not enabled and I, even thought I've looked for it, I couldnt find any option to enable it. I've also checked privileges just in case it had something to do with this, but didnt see anything neither.
    To sum up, could anyone tell me if drilling down is possible in direct database request and, if so, how can I achieve it?
    Thank you very much in advanced for any kind of help.

    NO!!!!!!!!!!
    You Direst SQL query should contain the url
    ex:
    SELECT COL1,COL2,
    '<a href=http://obiapps:9704/analytics/saw.dll?Go&Path=/Answers&path=%2Fshared%2FAppslink%20Dashboards%2F_portal%2FAppslink%20Dashboards%2FEmployee%20Department=Navigate&P0='+BUSINESS_GROUP_NAME+' target=_new>'+BUSINESS_GROUP_NAME+'</a>
    FROM TABLE
    then go for the column format
    Note: in MS SQL + is for concat, you might have to change based on your db.

  • Unable to Schedule a Direct Database Request in OBIEE 11g.

    Hi All,
    I am trying to schedule a Report that is generated using a Direct Database Request Query.
    Whenever I try to create an Alert for this specific Report it Fails to deliver.
    I checked the Job Manager for this Alert. I found out that the Job has completed with an Exit Code = 2 and there was no other error description for the same.
    Can we not create an alert for a Direct Database Request.
    Please let me know if anyone has dealed with such an issue and if anyone has a solution for this.
    Thanks in advance.
    Dev.

    Analyses based on direct database requests and sent out through agents work just like any other analysis in terms of content, delivery etc.
    Are you sure that you're not hitting a privilege problem and that the user executing the agents isn't allowed to run direct database requests?

  • Obiee 11g Executing a Direct Database Request in my Dashboard

    Hi Experts,
    i want to create in my dashboard Button:
    when i presses Button message will appear with question with 2 buttons :
                  1 Ok        : will execute Direct Database procedure.
                  2 Cancel : return to source dashboard.
    what is the way to execute ?
    I would appreciate your help.
    sin

    Analyses based on direct database requests and sent out through agents work just like any other analysis in terms of content, delivery etc.
    Are you sure that you're not hitting a privilege problem and that the user executing the agents isn't allowed to run direct database requests?

  • OBIEE 11.1.1.6.8 Direct Database Request

    I have created a report using direct database request and created a filters using Presentation variable as prompt
    However All choices from Prompt is not capturing but for any value its working fine. Please let me know how can we do for All choices with DDR
    Thanks
    NK

    you can't pass all the choices to direct database request because direct database and here there is no relationship with existing subject area. So only one dynamic value can pass from prompt else you can hardcode the values in the bind variable. For this please refer my link https://forums.oracle.com/thread/2562814

  • Date format in Direct database request

    I have a report with direct database request.
    I have a date prompt..I am storing the date in a Presentation Variable named pv_date.
    In the direct database request, I have a where clause:
    WHERE business_date IN ( @{pv_date}{'1/1/2013'} )
    when I run open dashboard for the first time, its throwing me an error near TIMESTAMP.
    WHERE business_date IN( TIMESTAMP ''2013-01-01 00:00:00'')
    AND ALSO When I run this report from dashboard after choosing a date say 2/20/2013, I see the query as:
    WHERE business_date IN (2013-02-20 00:00:00)
    and hence throwing error.
    Its throwing error in both the cases. How do I change the format in WHERE clause..
    Ideally, I want the query to be WHERE business_date IN ('2/20/2013') or Business_date IN ('2013-02-20')

    Thank you both.
    I am using Sybase and hence used convert function.
    But still I see the word TIMESTAMP in the query which is causing issue.
    business_date IN(CONVERT(char(10), TIMESTAMP ''2013-03-27 00:00:00'',101))
    and when I run the report by choosing any date, I see this: business_date IN(CONVERT(char(10),2013-03-27 00:00:00,101)) ; throwing error because No single quoted for the date.
    How do I remove the word TIMESTAMP?? and how do I impose single quotes..

  • Direct Database Request - EBS

    Hi All,
    I am new to OBIEE but have a question regarding Direct Database Request. We have our EBS data stored in the OBIEE Data Warehouse but we'd also like to be able to use some of our Oracle SQL Developer queries against our EBS database directly using OBIEE as the platform.
    Is there any issue with having our EBS data in the data warehouse as well as a data source for Direct Database Requests? I read something about security concerns involving write-access. I figure it's easier to use our SQL queries that we have already created than to attempt to map all of the tables and fields into the data warehouse. Also, some of the queries would be nice to have in real-time.
    Thx,
    Mike

    I don't have to worry about the transactional EBS data getting tangled in the data within the warehouse right? Also, are there any security concerns?I dont think so.
    I typically use an Appsro (read-only) user when querying EBS data. Will I have the option of using read-only or will I have write access? I ask b/c I read something about this that warned of security risk of overwriting data.Read only is fine, since BI is to see data, unless you implement Write-back functionality there wont be any write(data updates) in db.
    Edited by: Srini VEERAVALLI on May 1, 2013 9:51 AM
    It would be nice if you mark on helped suggestion too.
    Edited by: Srini VEERAVALLI on May 1, 2013 10:22 AM

  • Use of Filter in Direct Database Request for Custom Navigation

    Because of union and other complex sql code I am using Direct Database Request. (DDR) In 1st request based on DDR containing column Region, I need to do Region column value navigation to the Target report. The Target report is also based on DDR and has column Region.
    For 1st Report Region Column Value Navigation to work
    1. I did activate value interaction in 1st Report for Region column and set Target to Report 2.
    2. In 2nd Report, I have to use Filter and make region column "Is Prompted". But in DDR the filter is not available. How do I solve this problem?

    by using Direct database request your bypassing all the wanderful metadata you built in the BMM layer, as such much functionality is not available.
    If you really need to use such complex SQL, I would suggest creating an inline view in the phyiscal layer and at least model this through your BMM either as a flat data source (ie include the dimension columns and model the same inline view into your BMM star)
    If you do that, the BI Server will know what other logical columns this data source can relate you and you should find the navigation works as expected.
    If you dont fancy that good practice, have a look at creating GOURL formulas as the column fx's, format as HTML to present the data as a hyperlink and manually pass all the parameters to the 2nd report.
    I'd do the first option, its more inline with intended use.
    What cant you do using the 'normal modelling / answers techniqes with union (see combined request in answers) and complex sql (evaluate function in RPD)??

  • Obiee Answers Direct database request error

    Hi,
    I am learning obiee 10/g and installed 10g version on my laptop.
    when i tried to run the query in Answers through "direct database request"
    connection pool is > "SH"."Connection Pool"
    Sql statement is > Select * from Channels
    When i clicked on "validate sql and retrieve columns" button i get the below error
    error : Odbc driver returned an error (SQLExecDirectW).
    error : [nQSError: 16001] ODBC error state: S0002 code: 942 message: [Oracle][ODBC][Ora]ORA-00942: table or view does not exist. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
    error : SQL Issued: {call NQSGetQueryColumnInfo('EXECUTE PHYSICAL CONNECTION POOL "SH"."Connection Pool" SELECT * FROM Channels')}
    What could be the issue ... Please advise
    Thank You

    Hi,
    The channels table is in the database schema ..because i am able to drag the columns from channels table in answers and veiw the results.
    when the query runs through the RPD it works fine .
    but when i run the query using direct database request feature of answers...I see the error.

Maybe you are looking for

  • Restart dunning notice printout

    Hello all, I've got a problem with the dunning process (F150) of just one concret execution (id "XXXX"): - Parameters maintaned --> Ok - Proposal generated --> Ok - Dunning printout --> Ko --> Some items of some customers changed dunning level and so

  • CRC errors and input errors on Te 1/2 of Cisco WS-C3560X-48 switch

    Hi All, I am observing CRC errors and input errors on one of the Te1/2 interface of WS-C3560X-48 Cisco switch. I have not observed any CRC errors or input errors on the connected interface at other end. Can you please let us know whether the issue is

  • Datatable multible column sort labels

    How can i change labels of multible column sort panel to another language (Turkish). For example i want to convert "Primary Sort Column:" to "Birincil Sıralama Sütunu" . Thanks for your helps. Edited by: m4erler on 15.Tem.2008 13:39

  • JDev TP3 / UML Class Diagram / How can I specify a derivative attribute?

    Hello, I'm trying to put derivatives (or calculated) attributes such as "age" or "price" in a class of UML diagram. In all of UML books that I've seen, a derivative attribute is represented with a "/" and the attribute's name. For example, "/age" or

  • Phone contacts and Mac contacts

    My husband needed Verizon so just recently got the iPhone although I've had mine from the beginning. The Verizon people transferred all his contacts that he manually entered to his old phone, to the iPhone. We also have a huge list of contacts that a