Use a manual SQL query in an interface

Hello,
I would like to know if I can use a manual SQL query in an interface.
Here is what I need.
I have two tables.
T1 with 4 fields :
idT1, LibC, val, lib_val
An example of a line from T1
1, field1, 33 , value 33
2, field2, 44 , value 44
And table T2 with fields such as:
idT2, ... , field1, field2
There is no key to join T1 and T1, but I should retrieve the value of field lin_val from T2 which corresponds to the value of field1.
In SQL, the query looks like this:
SELECT t2.lib_val
FROM t2 , t1
WHERE T2.LibC = "Column_name"
AND T2.val = T1.Column_name
AND t1.idT1 = xyz

You should go for yellow interface.It will solve your problem. Here you go
http://odiexperts.com/how-to-create-a-temp-table-in-odi-interface/
https://blogs.oracle.com/warehousebuilder/entry/odi_11g_simple_flexible_powerful
Thanks.

Similar Messages

  • Using prompts with SQL query

    Post Author: wleonetti
    CA Forum: Crystal Reports
    Hello!
    I have acquired a report from our regional headquarters, and have been asked locally to add a prompt to one that already exists in the report.
    The report currently uses an SQL query, which in turn uses a single prompt to limit the data reported. However, the name of the parameter in the Field Explorer in Parameter Fields is "Facility", but, when I use the Database Expert and select edit for the query (under Selected Tables, right-click on "Command" under the database and click on "Edit Command"--is Command a default name?), under the Parameter List, the name of the parameter there is "Facility1" (?). The SQL references the parameter "Facility1" (...like '{?Facility1}'), but I cannot find any link/interface between the Parameter List "Facility1" to the Parameter Field "Facility", and I cannot find any other references to "Facility1" anywhere else in the report (sorry, I'm very new at CR, and am not sure how to do a global search of a desired text string in the reports).
    I have asked the author for an explanation, but he would only offer, after indicating that he ... was not obligated to help me in any way .., the following bone: "I just simply rename the parameter in Command from Facility1 to Facility which bears the same name as the parameter interface and it just works fine." This only served to confuse me more, since the parameter name currently in Command is  "Facility1" (and the report works the way it is)--when I change the name of the parameter in Parameter List (and the parameter name in the SQL query) to "Facility" (to match the Parameter Field's "Facility"?) ... the parameter in the Parameter Fields ... disappears?
    Can someone please instruct me how to, in whatever steps are necessary, add a parameter to the Parameter Fields and edit the SQL code to use that parameter? or point me to some documentation that will help me with this?
    Thanks in advance for any help offered.
    wleonetti

    Hi Eric,
    Try expressing the source as this:
    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
    It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • How to use property file - sql query define in property file

    Hi All,
    Anybody please tell me how to use property file.
    I have placed sql query in propery file and I have to access this in my file.
    well so far this is my code but don't know how to implement in the following ...
    pstmt = con.prepareStatement("select * from registration where username=?");
    instead of writting the query I want to use the property file.
    so far I have developed the following code...
    FileInputStream fis = new FileInputStream("querysql.property");
    Properties dbProp = new Properties();
    dbProp.load(fis);is the code correct... or is there another way to access property file
    Please help.
    please reply soon....
    Thanks

    Before answering, check if it's already been done here http://www.jguru.com/forums/view.jsp?EID=1304182

  • Using Parameters in SQL-Query not only in where clauses

    Hi,
    I try to use Publisher parameters in the SQL Query from a Data Set.
    All of them have default values.
    So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
    >
    select
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
                                            else :pv_some_Text end                                                                  as Betr_Teil,
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
                                            else :pv_some_Text end                                                        as Suva_Nr,
         case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
                                            else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end      as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
         fetch first 65001 rows ONLY
    >
    The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
    The parameter 'pv_some_Text' unfortunately not. (simple literals)
    When I try to validate the above SQL, I get the following Error:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
    </font>
    After use a cast function:
    >
    else CAST(:pv_some_Text AS CHARACTER)
    >
    I get this ERROR:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
    </font>
    We use OBIEE 11.1.1.6.4 on a Win64-System.
    Thank's for any help.

    Hi Alex,
    let's leave away any unnecessary details.
    This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
    >
    select
         '--1'     as Betr_Teil,
         '--2'      as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    Everything is fine when I click OK, the script goes back to the metadata.
    Let's try this script with bind values in ORACLE SQL Developer.
    This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
    >
    with
    sawith0 as
    select
    sum(t39617.ris_vollbesch) as c1
    from
    dm15d_betriebsteil t39455,
    dm15k_ris_fakten_pro_btt_jhr t39617
    where
    t39455.id_betriebsteil = t39617.id_betriebsteil
    and t39455.suva_nr_form = '122-4.4'
    select
    d1.c1 as c1,
    d1.c2 as c2,
    d1.c3 as c3
    from
    select
    :pv_some_text as c1,
    :pv_some_text as c2,
    sum(d1.c1) as c3
    from
    sawith0 d1
    d1
    where
    rownum <= 65001
    >
    This SQL works fine, even with bind values for 'pv_some_text'.
    But, when using the following SQL in the BIP Data Model:
    >
    select
         :pv_Text as Betr_Teil,
         :pv_Text as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    The following ERROR occurs:
    <font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
    In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
    Thank you for your most welcome help.

  • Question about using objects in SQL query.

    I had posted this question in the SQL/PLSQL forum but I guess nobody took the time to understand exactly what I am asking so I decided to try here hoping to get the answer. So here is the thing:
    I have created generic object type "tree" - the constructor takes as a parameter sql query which returns "node_id" and "parent_node_id" - this is all we need to have a tree. The object has all related to a tree structure member functions and one of them is "oldest_relative" (the tree may not be fully connected - it may be more like a set of many trees, so it's not necessary all nodes to have the same root).
    I also have departments table with the following fields: department_id, parent_department_id, department_name,...
    all records in the table w/out parent_departments (parent_department_id is null) are considered divisions.
    Now if I run the following query:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT_NAME", tree('select department_id "node_id", parent_department_id "parent_node_id" from departments').oldest_relative("DEPARTMENT_ID") "DIVISION_ID" FROM departments
    my question is: Is the tree object created for every row or does Oracle somehow caches the object since the object itself is not changing but only the parameter for the oldest_relative member function.
    The table only has a few hunderd records and I can't see much of a difference in the execution time btw the query above and query like this:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT_NAME", b.t.oldest_relative("DEPARTMENT_ID") "DIVISION_ID"
    FROM departments left join (select tree('select department_id "node_id", parent_department_id "parent_node_id" from departments') t from dual) b on 1 = 1
    where the object is clearly created just ones. (there is probably a better way to do it instead of this join)
    Pls elaborate
    George

    Not exactly sure what the question is...
    As I understand, you are comparing the following two constructor calls:
    +select..  tree('select department_id "node_id", parent_department_id "parent_node_id" from departments').oldest_relative("DEPARTMENT_ID") ... FROM ...+
    +select tree('select department_id "node_id", parent_department_id "parent_node_id" from departments') ... FROM dual+
    These calls are the same (besides the 1st one doing an immediate implicit call to a method of the object being constructed). The number of times these are being called depends on the number of times this SQL projection is applied - and that is determined by the number of rows being projected by the SELECT.
    The latter one is against DUAL which only has a single row. So that constructor is only called once. The former can be against multiple rows. Obviously a single pass through a data set is desirable - which means that the sub-select (use by the constructor) should ideally only be executed once and makes the 2nd method more desirable.
    However, I'm having a hard time understanding why the class and constructor are at all needed. Why pull data from a SQL table into PL memory? As that is where the class will need to cache and store the results of that construction parameter SQL SELECT. And once in PL memory, how does the object effectively access, search and use this cached data?
    PL memory is expensive. It is not sharable.
    PL data structures are primitive - these cannot be compared to SQL structures in the form of tables and columns that can be stored in a number of physical ways (index tables, hash tables, partitioned tables, clustered tables, etc). Cannot be indexed like SQL structures using B+tree, bitmap, function and other indexing methods. Cannot be sorted, grouped, analysed, filtered, etc like SQL structured data.
    It makes very little sense to read SQL data into a class and then deal with that data, cached in expensive PL memory, using primitive PL structures.
    And the same would be true if Java or C# was used. The best place for data is inside the SQL engine. That is the most superior environment for data. It can processes more data, scale better, perform better and offer more flexibility, than pulling data from it and then crunch that data using PL or Java or C#.

  • Using 'Function Returning SQL Query' with Flash charts

    I have created a pl/sql function that returns a SQL query as a varchar2 of this form:
    select null link
    <x value> value
    <Series1 y value> Series 1 Label
    <Series2 y value> Series 2 Label
    <Series3 y value> Series 3 Label
    from tablea a
    join tableb b
    on a.col = b.col
    order by <x value>
    If I now call the function from a Flash Chart Series SQL box with the Query Source Type set to 'Function Returning SQL Query' like this:
    return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'))
    it parses correctly and the page is saved; however, when I run the page I don't get any output - nor any error messages or other indication of a problem.
    Now, if I call the function in a SQL client, capture the SQL query output using dbms_output and paste that into the Flash Chart Series SQL box - changing the Query Source Type to SQL Query - and save the page it works fine when I run it and returns a multi-series flash chart.
    Can anyone suggest either;
    1. What have I might have missed or done wrong?
    2. Any way to usefully diagnose the problem...
    I have tried using the Apex debugger - which is very nice, by the way - but it doesn't provide any info on what my problem might be. I even tried writing my own debug messages from my function using the apex_debug_message package - got nothing...
    Thanks,
    Eric

    Hi Eric,
    Try expressing the source as this:
    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
    It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • Use var of sql:query tag into a jsp fragment code

    Hi, i'm spanish and my english is not very good XD.
    I need to use some data from <sql:query> tag into code jsp <% %>
    EXAMPLE:
    <sql:query var="variable">
    </sql:query>
    <% what can i do to access to "variable" here????????? %>
    i need to save in session (session.setAttribute(...)) a field of the response of the query saved in "variable"
    i need help!!!!, thanks!!!!!!!!

    i need to save in session (session.setAttribute(...)) a field of the response of the query saved in "variable"Why do you need java code to do this? If you are using JSTL sql tags, then why not keep using JSTL tags?
    <c:set var="valueToSave" value="${variable.field}" scope="session"/>EL variables are actually already stored as attributes in scope.
    So to get hold of "variable" you could use <%= pageContext.findAttribute("variable") %>
    and that would give you the object stored by the EL.
    cheers,
    evnafets

  • Bug when using alias in sql query?

    I don't know if this is a problem related to the getString function of the MetaData class, or if it is something else. I'm having problems when sending a select query containing a specification for column alias to the execute function of the Statement class. Whenever the alias is more than 11 characters it crashes, saying the heap may be corrupt. When the alias is <=11 or there is no alias specified, there are no problems to get the name.
    After executing a query I am looping through the vector of MetaData objects retrieved from the ResultSet and its getColumnListMetaData to get information about each column, among other things the column name. The crash occurs when it comes to the execution of getString(MetaData::ATTR_NAME). As I said, this does not happen when no alias is set, it will pass by without any errors.
    I am using visual studio 2005, oracle 10g release 2 and the downloaded debug versions of occi for visual studio 2005.

    Hi,
    Is this what you are trying:
        try {
        Statement *stmt = conn->createStatement("SELECT ename AS aaaaaaaaaaaaaaa  FROM emp");
          ResultSet *rs = stmt->executeQuery ();
          vector<MetaData> md = rs->getColumnListMetaData ();
          int numCols = md.size ();
          cout<< "Number of columns :" << numCols << endl;
          string *colName = new string [numCols];
          int type = (int ) malloc (numCols);
          for (int i = 0; i < numCols; i++ ) {
            int ptype = md [ i ].getInt (MetaData::ATTR_PTYPE);
            if ( ptype == MetaData::PTYPE_COL ) {
              colName[ i ] = md[ i ].getString (MetaData::ATTR_NAME);
              cout<<"Column Name :" << colName[ i ] << endl;
          delete[] colName;
          stmt->closeResultSet (rs);
          conn->terminateStatement (stmt);
        catch (SQLException &ex) {
                    cout<<ex.getMessage()<<endl;
        }The above snippet works correctly for me.
    Rgds.
    Amogh

  • Using regr_slope in sql query

    Hi ,
    I have one question on predicting the sale for next 5 years  along with month  the data as follows.
    YEAR  Month  Total_Sale
    2009    1          88187
    2009     2         87654
    2009     3         87656
    2008     1         10000
    2008     2          30000
    2008     3          40000
    How to use regr_slope and other function for the prediction of sale to next year?
    Thanks,
    HS

    Hi,
    de45e462-4cf1-4ad2-8f0b-4688375a6400 wrote:
    Hi ,
    Fixed the input data script as follows as per the suggestion.
    REM INSERTING into SALE_GROWTH
    SET DEFINE OFF;
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,1,1000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,2,2000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,3,3000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,4,1000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,5,5000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,6,2000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,8,3000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,9,700);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,10,10000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,11,30000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,12,2000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,9,6000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2008,8,100);
    Now the output  i want for the future years   2014,2015.
    -HS
    What is the output you want for the future years 2104, 2015?
    It seems like this sample data isn't really any simpler than the old sample data.  Again, why is month 4 (I assume that's April, but it doesn't really matter) lower than all the other months, before and after it?
    It's unclear if you're really talking about linear regression, or something more complicated.  Do you really need to post sample data that's more complicated than this?
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,1,1000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,2,2000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,3,3000);
    Insert into SALE_GROWTH (YEAR,MONTH,TOTAL_SALE) values (2009,5,5000);
    Here, there is a predictable increase of exactly 1000 every single month, so we know the expected results  for the next 12 months would be:
    MONTH_YEAR      EXPECTED_SALES
    September, 2013          57000
    October, 2013            58000
    November, 2013           59000
    December, 2013           60000
    January, 2014            61000
    February, 2014           62000
    March, 2014              63000
    April, 2014              64000
    May, 2014                65000
    June, 2014               66000
    July, 2014               67000
    August, 2014             68000
    Here's one way to get those results, using the aggregate REGR_SLOPE and REGR_INTERCEPT functions:
    WITH   got_slope_and_intercept   AS
        SELECT   REGR_SLOPE     (total_sale, month + (12 * year))   AS slope
        ,        REGR_INTERCEPT (total_sale, month + (12 * year))   AS intercept
         FROM   sale_growth
    SELECT   TO_CHAR ( ADD_MONTHS (SYSDATE, LEVEL)
                     , 'fmMonth, YYYY'
                     )       AS month_year
    ,        intercept + ( slope * (        EXTRACT (MONTH FROM SYSDATE)
                                   + ( 12 * EXTRACT (YEAR  FROM SYSDATE))
                                   + LEVEL
                         )   AS expected_sales
    FROM     got_slope_and_intercept
    CONNECT BY   LEVEL <= 12

  • Kodo 3.4.1: how to limit # of sql query params when using collection param

    Hi,
    We have a problem when using Kodo 3.4.1 against SQL Server 2005, when we execute query:
              Query query = pm.newQuery( extent, "IdList.contains( this )" );
              query.declareParameters( "Collection IdList" );
              query.declareImports( "import java.util.Collection;" );
              return (List) query.execute( list );
    We got:
    com.microsoft.sqlserver.jdbc.SQLServerException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
    at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:354)
    at com.solarmetric.jdbc.PoolConnection$PoolPreparedStatement.executeQuery(PoolConnection.java:341)
    at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:352)
    at com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1106)
    at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:352)
    at kodo.jdbc.runtime.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1730)
    at com.solarmetric.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:339)
    at kodo.jdbc.sql.Select.execute(Select.java:1581)
    at kodo.jdbc.sql.Select.execute(Select.java:1533)
    at kodo.jdbc.runtime.SelectResultObjectProvider.open(SelectResultObjectProvider.java:102)
    at com.solarmetric.rop.EagerResultList.<init>(EagerResultList.java:22)
    at kodo.query.AbstractQuery.execute(AbstractQuery.java:1081)
    at kodo.query.AbstractQuery.executeWithArray(AbstractQuery.java:836)
    at kodo.query.AbstractQuery.execute(AbstractQuery.java:799)
    It seems that there're too many ids in the list, and Kodo didn't limit the # of sql parameters when craft the sql query. Is there a way to ask Kodo to use multiple queries with smaller # of sql parameters instead of using one big sql query?
    Thanks

    Hi,
    Sadly, there is no way to do that in Kodo currently. The closest is the inClauseLimit DBDictionary setting, but that setting just breaks things up into multiple IN statements put together with an OR clause. In your case, it looks like the network transport, not the SQL parser, is complaining about size limits.
    You could force the query to run in-memory, but that would probably be prohibitively slow, unless the data set that you're querying against is relatively small.
    -Patrick

  • Apex 4.2 Report region sql query with "apex_item.text" renders wrongly

    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name=&quot;f01&quot; size=&quot;20&quot; maxlength=&quot;2000&quot; value=&quot;111&quot;  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?
    I need that function "apex_item.text", i cannot remove it.
    Edited by: CharlesRoos on 13.02.2013 15:28
    Edited by: CharlesRoos on 13.02.2013 15:29
    Edited by: CharlesRoos on 13.02.2013 15:29

    CharlesRoos wrote:
    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name="f01" size="20" maxlength="2000" value="111"  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?Ensure that the Display As Column Attribute for the C1 column is Standard Report Column.

  • Setting current values in Multiple Select List in SQL Query based Report

    Hi,
    I have a report based on a sql query that contains a multiple select list. Unfortunately I cannot get the multiple select list to display the current values (p_value) correctly. I have created a page item, :p311_current_versions, that is set using a pre-header process and it returns a value with a colon delimited format e.g. '10.1.2.1.0:10.1.2.2.0'. Then this item is used in the sql query to set the current value (p_value) of the apex_item.select_list_from_query function. However when the table is displayed, instead of having two entries, 10.1.2.1.0 and 10.1.2.2.0 selected, it has an extra entry '10.1.2.1.0:10.1.2.2.0' selected.
    Here is my code:
    select distinct a.product, a.version from (
    select distinct
    apex_item.display_and_save(2,product)||apex_item.hidden(1,env_product_id) PRODUCT,
    APEX_ITEM.SELECT_LIST_FROM_QUERY(3,decode(product, 'HTTP Server' , :p311_current_versions, version), 'SELECT distinct version d, version r FROM ebs_tech_stack where
    product ='''||PRODUCT||'''',
    decode(PRODUCT, 'HTTP Server' ,'multiple="multiple" style="width:170px"','style="width:170px"'),
    'NO') as version
    from ebs_environment_tech_stack
    where environment_id = :p311_umgebung_id) a order by a.product
    If anyone can help me figure out how to set the current values correctly I'd be really grateful!!
    Thanks in advance,
    Jean

    Jean,
    I don't think this is possible using the apex_item package. The select_list_from_query function accepts only a single value for the second parameter.
    Scott

  • Resolve column names in a sql Query

    Hi Folks,
         I’m upgrading an application and there are database columns that have major changes that could affect production reports. I would like to survey v$SQL for a few days to see if these columns are affected. Here’s the problem.
    Looking at a SQL query to determine which columns are used is not nearly as easy as it sounds. Are there any oracle functions or 3rd party tools that can be used to list the columns used by a sql query? (this gets extremely tricky when subqueries become involved)
    For instance.
    select
    name, b.dep_id, employee_id
    From emp a
    Inner join v_department b on a.dep_id=b.dep_id
    Columns used:+
    Emp.name+
    Departments.dep_id (under the view)+
    Emp.employee_id+
    Emp.dep_id (from the join)+

    If you're on > 10g, you can use dbms_xplan with "all" option.
    It shows "column projection information" which is exactly what you want.
    UKJA@ukja102> set serveroutput on
    UKJA@ukja102>
    UKJA@ukja102> drop table t1 purge;
    Table dropped.
    Elapsed: 00:00:00.03
    UKJA@ukja102> create table t1(c1 int, c2 int);
    Table created.
    Elapsed: 00:00:00.03
    UKJA@ukja102>
    UKJA@ukja102> explain plan for
      2  select
      3    t1.c1, t1.c2, v.cnt
      4  from t1,
      5    (select /*+ no_merge */ c1, count(*) as cnt
      6        from t1
      7        group by c1) v
      8  where
      9    t1.c1 = v.c1
    10  ;
    Explained.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102> @plan_all
    UKJA@ukja102> select * from table(dbms_xplan.display(null,null,'all'))
      2  /
    PLAN_TABLE_OUTPUT                                                              
    Plan hash value: 536125944                                                     
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |  
    |   0 | SELECT STATEMENT     |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |*  1 |  HASH JOIN           |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |   2 |   TABLE ACCESS FULL  | T1   |     1 |    26 |     2   (0)| 00:00:01 |  
    |   3 |   VIEW               |      |     1 |    26 |     3  (34)| 00:00:01 |  
    |   4 |    HASH GROUP BY     |      |     1 |    13 |     3  (34)| 00:00:01 |  
    |   5 |     TABLE ACCESS FULL| T1   |     1 |    13 |     2   (0)| 00:00:01 |  
    Query Block Name / Object Alias (identified by operation id):                  
       1 - SEL$1                                                                   
       2 - SEL$1 / T1@SEL$1                                                        
       3 - SEL$2 / V@SEL$1                                                         
       4 - SEL$2                                                                   
       5 - SEL$2 / T1@SEL$2                                                        
    Predicate Information (identified by operation id):                            
       1 - access("T1"."C1"="V"."C1")                                              
    Column Projection Information (identified by operation id):                    
       1 - (#keys=1) "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22],                   
           "V"."CNT"[NUMBER,22]                                                    
       2 - "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22]                              
       3 - "V"."C1"[NUMBER,22], "V"."CNT"[NUMBER,22]                               
       4 - (#keys=1) "C1"[NUMBER,22], COUNT(*)[22]                                 
       5 - "C1"[NUMBER,22]                                                         
    Note                                                                           
       - dynamic sampling used for this statement                                  
    40 rows selected.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102>
    UKJA@ukja102> @end
    UKJA@ukja102> set echo offDion Cho

  • Pl/sql function body returning SQL query - Print function

    Hello all,
    I have pl/sql function body returning SQL query for my reports for my new project that I am developing. We dont have any BI tool or anything for APEX so we use Oracle reports to get the same reports to be printed in PDF format. I had been using SQL function for Reports all these days and grabbing the data using SQL query was easy in Oracle reports. But this time we had atleast 8 fields in search criteria and hence I thouhgt PL/sql function body returning SQL query could be something easy to handle that scenario. We have 11 such reports in our project. Now when we tried to use the same PL/sql function to oracle reports , I was told by one of our Oracle reports expert, that we have to write it into functions and use it in SQL query to get the Reports in Oracle reports. Is there any Easy way to convert the same Pl/SQL function or get a PDF format of the same report in APEX without going thru the much pains of rewriting the whole SQL Query.
    thank you
    Devisri

    Hi,
    give this a go.
    I can't test it as I don't have the tables in my schema.
    create or replace package MK_TEST_PF is
    -- Author  : MK
    -- Created : 21/06/2010 16:30:19
    -- Purpose : FOR LUCY_DISCOVER
    -- Public type declarations
    /*     -- just guess the table row types.....
         -- otherwise it won't compile
         type test_rec is record
              (INV REP.inv%type
              ,cNUMBER REP.cNUMBER%type
              ,OPENDATE REP.OPENDATE%type
              ,TARGETDATE REP.ESTCOMPLETE%type
              ,DATECLOSED REP.COMPLETED%type
              ,STATUS REP.STATUS%type
              ,cCODE REP.cCODE%type
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS REP.CLASS%type
              ,SUMM REP.SUMM%type
              ,AREA REP.AREA%type
         type test_rec is record
              (INV varchar2(4000)
              ,cNUMBER varchar2(4000)
              ,OPENDATE varchar2(4000)
              ,TARGETDATE varchar2(4000)
              ,DATECLOSED varchar2(4000)
              ,STATUS varchar2(4000)
              ,cCODE varchar2(4000)
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS varchar2(4000)
              ,SUMM varchar2(4000)
              ,AREA varchar2(4000)
         type test_tab is table of test_rec;
    -- Public constant declarations
    -- Public variable declarations
    -- Public function and procedure declarations
    end MK_TEST_PF;
    create or replace package body MK_TEST_PF is
    -- Private type declarations
    -- Private constant declarations
    -- Private variable declarations
    -- Function and procedure implementations
         function get_query_f
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              return varchar2
         is
              v_sql VARCHAR2(5000);
         --     v_inv VARCHAR2(100);
         --     v_reg VARCHAR2(100);
         --     v_proarea VARCHAR2(100);
         --     v_status VARCHAR2(100);
         --     v_SIG VARCHAR2(100);
         --     v_disp VARCHAR2(100);
         --     v_coding VARCHAR2(100);
         --     v_inc_sum VARCHAR2(4);
         --     v_word VARCHAR2(4000);
              v_wildcard VARCHAR2(2000);
         --     v_timeframe VARCHAR2(100);
         --     v_rec VARCHAR2(5);
              v_record VARCHAR2(5);
              v_open VARCHAR2(100);
              v_closed VARCHAR2(100);
              v_PEND VARCHAR2(100);
              v_refSIG VARCHAR2(100);
              v_refreg VARCHAR2(100);
              v_refother VARCHAR2(100);
              v_y varchar2(100);
         BEGIN
              --v_inv := UPPER(v('P44_INV')) ;
              v_record := 'R%';
              v_wildcard := '%';
              v_open := 'OPEN';
              v_closed := 'CLOSED';
              v_PEND := 'PEND';
              v_refSIG := 'REF - SIG';
              v_refreg := 'REF - CLASS';
              v_refother := 'REF - OTHER';
              v_y := 'Y';
              v_sql := 'SELECT REP.INV as INV, REP.cNUMBER as cNUMBER, REP.OPENDATE as OPENDATE,
              REP.ESTCOMPLETE as TARGETDATE, REP.COMPLETED as DATECLOSED, REP.STATUS as STATUS,
              REP.cCODE as cCODE, apex_item.checkbox(1,REP.line,null,'''||v_y||''') line , apex_item.checkbox(1,REP.SIG,null,'''||v_y||''') SIGc ,
              REP.CLASS as CLASS, REP.SUMM as SUMM, REP.AREA as AREA from REP where 1=1';
              IF p_rec is not null then
                   IF p_rec = 'E' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) not like '''||v_record||'''';
                   ELSIF p_rec = 'D' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) like '''||v_record||'''';
                   ELSIF p_rec = 'I' then
                        v_sql := v_sql|| ' and REP.cnumber = REP.cnumber ';
                   end if ;
              end if ;
              IF upper(p_status) not like '%NULL%' then
                   IF upper(p_status) like '%OPEN%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_open||'''';
                   ELSIF upper(p_status) like '%CLOSED%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_closed||'''';
                   ELSIF upper(v_PEND) like '%PEND%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_PEND||'''';
                   ELSIF upper(v_refSIG) like '%REF - SIG%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refSIG||'''';
                   ELSIF upper(v_refreg) like '%REF - CLASS%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refreg||'''';
                   ELSIF upper(v_refother) like '%REF - OTHER%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refother||'''';
                   END IF ;
              END IF ;
              IF p_inv = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.INV),'''||p_inv||''') > 0';
              END IF ;
              IF p_reg = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.CLASS),'''||p_reg||''') > 0';
              END IF ;
              IF p_proarea = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.AREA),'''||p_proarea||''') > 0';
              END IF ;
              IF p_disp = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.disposition),'''||p_disp||''') > 0';
              END IF ;
              IF p_coding = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.ccode),'''||p_coding||''') > 0';
              END IF ;
              IF p_SIG = ' ' THEN
                   v_sql := v_sql||' AND instr(upper(REP.SIG),'''||p_SIG||''') > 0';
              END IF ;
              IF p_word is not null then
                   v_sql := v_sql|| ' and
                   instr(upper(REP.SUMM),
                   upper(nvl('''||p_WORD_IN_SUMM||''',REP.SUMM))) > 0';
              end if ;
              If p_timeframe is not null then
                   if upper(p_timeframe) = 'OPEN' then
                   v_sql := v_sql|| ' and to_date(REP.opendate) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'CLOSED' then
                   v_sql := v_sql|| ' and to_date(REP.completed) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'EST' then
                   v_sql := v_sql|| ' and to_date(REP.estcomplete) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   end if;
              end if;
              v_sql := v_sql ||' order by REP.INV ';
              return v_sql;
         end get_query_f;
         function test_pf
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              RETURN test_tab PIPELINED
         is
              type test_c is ref cursor;
              v_row test_tab;
              v_sql varchar2(4000);
              v_cursor test_c;
         begin
              v_sql := get_query_f
                   (p_inv
                   ,p_reg
                   ,p_proarea
                   ,p_disp
                   ,p_coding
                   ,p_status
                   ,p_SIG
                   ,p_inc_sum
                   ,p_word
                   ,p_timeframe
                   ,p_rec
                   ,p_WORD_IN_SUMM
                   ,p_ON_AFTER
                   ,p_ON_BEFORE
              open v_cursor for v_sql;
              fetch v_cursor bulk collect into v_row;
              close v_cursor;
              for i in 1 .. v_row.count loop
                   pipe row (v_row(i));
              end loop;
              return;
         end test_pf;
    end MK_TEST_PF;
    /Regards
    Michael

  • Mapping Problem with Native SQL query

    My application uses a native SQL query to locate certain entities. It looks like this:
    SELECT UPLOADATTEMPTREF, STUDENTNUMBER, USERID, WORKITEMCODE, WORKITEMINSTURN, WORKITEMTITLE, MODULERUNCODE, STUDENTNAME, SUBMISSIONDEADLINE, UPLOADATTEMPTSERVERDATE, FILENAME, UPLOADCOMPLETESERVERDATE, NEWFILENAME, FILESIZE, FILEPATH, DOWNLOADSERVERDATE, MODULECODE, MODULETITLE
    FROM Submission_Attempt WHERE UPLOADATTEMPTREF IN (
    SELECT uploadAttemptRef FROM (" +<br /><br />                         "SELECT MAX(uploadAttemptRef) AS uploadAttemptRef, UserID, workItemInstUrn, " +<br /><br />                         "workItemCode FROM Submission_Attempt where workiteminsturn = ?1 " +<br /><br />                         "GROUP BY UserID, workItemInstUrn, workItemCode) Table1 ) " +<br /><br />                         "and uploadCompleteServerDate is not null;"<br />
    My expectation was that EclipseLink would be able to handle the mapping of the results to the entity quite happily. However, I get a NonSynchronizedVector of Objects - each Object representing one field of data.
    I need help with either:
    Converting the above SQL into JPQL so that I (hopefully) don't have to worry about the SQL or
    Understanding why this isn't working properly...
    Anyone able to help?
    Edited by: phunnimonkey on Nov 6, 2008 3:33 AM

    Never mind - the problem was to do with not specifying a class when creating the native query.

Maybe you are looking for

  • Which jar to use in order to write add-ons for IE

    Hi, I don't know whether I am asking the correct question but I want to know can I use any jar in order to create add-ons for Internet explorer and, if any, which one? thanks

  • Jsp debugging, verbose=true

    hi,           i want to get compile-time and run-time errors directed to the browser and           setting verbose=true in the properties file should do this right? well, it's           not. any ideas?           here's my jsp config entry in weblogic

  • IPod only comes to plug in screen

    After upgrading to IOS 7 iPod only comes up with the plug in screen. It will not finish booting up. How do I fix it.

  • Two folders in the Photo Photostream. Why?

    I Have iPhone 3GS (iOS 5.0) After synchronization iTunes 10.5 with my phone: Two folders in the Photo Photostream. Why?

  • When i use oracle vwp give this error (java.lang.IllegalArgumentException:

    sir i use oracle with vwp sir see my code this code goto catch (Exception e) section and give this code in textfield " java.lang.IllegalArgumentException: luser.username " when i use mysql that give right result but when use oracel that give me this