SQL statement with Function returns slow in Interactive Report

I have an Interactive Report that returns well but when I add in a function call in the where clause that does nothing but return a hard coded string of primary keys and is compared to a table's primary key with a like operator the performance tanks. Here is the example:
get_school2_section(Y.pk_id,M.pk_id,I.section,:P577_SECTION_SHUTTLE) LIKE '%:' || I.pk_id || ':%'
I have the values hard coded in the return of the function. There are no cursors run in the function, there is no processing done in the function. It only declares a variable. Sets the variable, and returns that variable back to the SQL statement.
I can hard code the where clause value to look like this:
':90D8D830A877CCFFE040010A347D1A50:8ED0BBFDEAACC629E040010A347D6471:9800B8FDBD22B761E040010A347D0D9A:' LIKE '%:' || I.pk_id || ':%'
This returns fast. When I add in the function call which returns the same hard coded values, the page goes from returning in 1 to 2 seconds to 45 or more seconds.
Why does adding a simple function call into the where clause cause such a deterioration in performance.
Edited by: alamantia on Aug 17, 2011 7:39 AM
Edited by: alamantia on Aug 17, 2011 7:40 AM

So you are telling me that the where clause with a function call will NOT run the function on every row? Please explain that to me further?
if you have code that is the following:
select a,b,c from a_table where a > 2 and b < 3 and function_call(c) > 0You are telling me that Oracle will NOT call that function on EVERY row it tries to process in the select?
Thank you,
Tony Miller
Webster, TX
I cried because I did not have an office with a door until I met a man who had no cubicle.
-Dilbert
If this question is answered, please mark the thread as closed and assign points where earned..

Similar Messages

  • Pl/sql statement with output in reports

    Hello,
    I am quite new to reports and pl/sql, i have built a pl/sql statement with some loops that works fine when running it in sqlplus.
    I would really like to have this running in reports with the variables (v_year, v_month and v_sumvalue) in a table/record in the data view, so i can use them just like any ordinary fields in a table for example in a diagram.
    I have tried to create a package spec, setting up a record with the variables as fields. And then a pl/sql function with the following sql (which was a bit modified to work in the pl/sql function). Everything seemed to work since the pl/sql table/record was there with the variables as fields in it, but it never returned anything... just fatal error.
    Here is the original pl/sql statement which is working in sqlplus, any help/directions in how to get this working so i can use the variables like fileds in a regular table would be fantastic:
    DECLARE
       v_year number(4);
       v_month number(2);
       v_sumvalue number(9,3);
       v_sta varchar2(10);
       v_end varchar2(10);
       v_stopmonth number(2);
    BEGIN
       --## Get last 5 years ##--
       select
          to_char(add_months(sysdate,-60),'YYYY'),
          to_char(sysdate,'MM')
          into v_year, v_stopmonth
       from
          dual;
       --dbms_output.put_line(v_year);
       --## Loop 5 years ##--
       for i in 1..5 loop
          v_year := v_year + 1;
          --dbms_output.put_line(v_year);
          --## Loop 12 times (months) ##--
          for k in 0..11 loop
             v_month := k +1;
             --dbms_output.put_line(v_year ||'-'|| v_month);
             select
                sum(nvl(p.value,0)) / 3,
                last_day(add_months(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'),-3))+1,
                last_day(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'))
                into v_sumvalue, v_sta, v_end
             from
                project p
             where
                p.country_code = 'SWE'
             and
                p.project_type_code = 'P'
             and
                p.start_date between last_day(add_months(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'),-3))+1 and last_day(to_date(v_year ||'-'|| v_month ||'-01','YYYY-MM-DD'))
             and
                p.q_category_code between 1000 and 1299
             and
                p.geography_code between 2100 and 2199;
             dbms_output.put_line(v_year ||'-'|| v_month ||' '|| v_sumvalue);
             --dbms_output.put_line(v_year ||'-'|| v_month ||' '|| v_sumvalue ||' '|| v_sta ||' '|| v_end);
          --## Stop monthloop ##--
          end loop;
       --## Stop yearloop ##-
       end loop;
    END;Output:
    2003-1 19.1
    2003-2 20.1
    2007-11 164.5
    2007-12 135.167Best regards,
    Olle

    Hi,
    Maybe pipelined functions will be useful for you:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/x/Table_Functions_Cursor_Expressions/Pipelined_Table_Functions.htm
    Regards
    Jakub Flejmer

  • SQL statement with LIMIT and total count?

    Hello,
    I would like to know if it is possible to execute a single SQL statement that will return me a subset of data (for pagination purposes) that not only includes the subset of data for the page but the count of all available data. Can this be done so as to not take up the cpu and time it takes to essentially run two queries? One to get the subset and one to get the count? I think simply doing a subselect is not going to give me what I want in that we actually query twice.
    There may be no way to do this other than that, but I wanted to check with the gurus here first. :)
    Thanks,
    Mark

    select *
    from (
    select i.*,
    row_number() over(order by i) rn, -- used for
    pagination
    count(*) over(partition by 1) cnt  -- total count
    of rows found for this search
    from mytable
    where < PUT ALL LIMITING (i.e., "search") CONDITIONS
    HERE >
    where rn between 41 and 50 -- pagination clauseNice one
    BUT of course it adds additional row in execution plan and takes additional time and CPU :)
    I assume that it directly depends of course on returned result set and some other factors like available sort space but a simple test case on a table big which actually is 1.6 M rows like dba_source got following results:
    here is the first one returning also count(*)
    SQL> select *
      2  from (
      3    select i.*,
      4      row_number() over(order by owner, name, type) rn
      5  , -- used for pagination
      6      count(*) over(partition by 1) cnt  -- total count of rows found for this search
      7    from big i
      8    where owner like 'S%' and name like '%A%'
      9  )
    10  where rn between 41 and 45
    11  /
    OWNER                          NAME                           TYPE
          LINE
    TEXT
            RN        CNT
    SYS                            ANYDATA                        TYPE
            13
      STATIC FUNCTION ConvertVarchar(c IN VARCHAR) return AnyData,
            41     999744
    SYS                            ANYDATA                        TYPE
            11
      STATIC FUNCTION ConvertDate(dat IN DATE) return AnyData,
            42     999744
    SYS                            ANYDATA                        TYPE
             9
            43     999744
    SYS                            ANYDATA                        TYPE
             7
         They serve as explicit CAST functions from any type in the Oracle ORDBMS
            44     999744
    SYS                            ANYDATA                        TYPE
             6
         enable construction of the AnyData in its entirity with a single call.
            45     999744
    Elapsed: 00:00:41.02
    SQL> ed
    Wrote file afiedt.buf
      1  select n.name, m.value from v$statname n, v$mystat m
      2  where n.statistic# = m.statistic#
      3*   and (upper(name) like '%SORT%' or upper(name) like '%TEMP%')
    SQL> /
    NAME                                                                  VALUE
    physical reads direct temporary tablespace                            35446
    physical writes direct temporary tablespace                           17723
    RowCR attempts                                                            0
    SMON posted for dropping temp segment                                     0
    sorts (memory)                                                           36
    sorts (disk)                                                              1
    sorts (rows)                                                        1999596
    OTC commit optimization attempts                                          0
    8 rows selected.here is the second one returning only rows:
    SQL> ed
    Wrote file afiedt.buf
      1  select *
      2  from (
      3    select i.*,
      4      row_number() over(order by owner, name, type) rn
      5  --, -- used for pagination
      6  --    count(*) over(partition by 1) cnt  -- total count of rows found for this search
      7    from big i
      8    where owner like 'S%' and name like '%A%'
      9  )
    10* where rn between 41 and 45
    SQL> /
    OWNER                          NAME                           TYPE
          LINE
    TEXT
            RN
    SYS                            ANYDATA                        TYPE
            13
      STATIC FUNCTION ConvertVarchar(c IN VARCHAR) return AnyData,
            41
    SYS                            ANYDATA                        TYPE
            11
      STATIC FUNCTION ConvertDate(dat IN DATE) return AnyData,
            42
    SYS                            ANYDATA                        TYPE
             9
            43
    SYS                            ANYDATA                        TYPE
             7
         They serve as explicit CAST functions from any type in the Oracle ORDBMS
            44
    SYS                            ANYDATA                        TYPE
             6
         enable construction of the AnyData in its entirity with a single call.
            45
    Elapsed: 00:00:12.09
    SQL> select n.name, m.value from v$statname n, v$mystat m
      2  where n.statistic# = m.statistic#
      3    and (upper(name) like '%SORT%' or upper(name) like '%TEMP%')
      4  /
    NAME                                                                  VALUE
    physical reads direct temporary tablespace                                0
    physical writes direct temporary tablespace                               0
    RowCR attempts                                                            0
    SMON posted for dropping temp segment                                     0
    sorts (memory)                                                           10
    sorts (disk)                                                              0
    sorts (rows)                                                         999812
    OTC commit optimization attempts                                          0
    8 rows selected.So execution time 41 sec vs 12 sec
    sorts (rows) 1 999 596 vs 999 812
    physical reads/writes direct temporary tablespace 35446/17723 vs 0/0
    I assume that for a small overall returned row count it probably is OK, but for less restrictive search it can be quite deadly as before with two queries.
    Gints Plivna
    http://www.gplivna.eu

  • ABAP/4 Open SQL statement with WHERE ... LIKE and pattern too long

    Dear All,
    I am getting an error "ABAP/4 Open SQL statement with WHERE ... LIKE and pattern too long" while executing the following statement:
    CLEAR LS_RANGE.
    LS_RANGE-SIGN     = 'I'
    +LS_RANGE-OPTION     = 'CP'     +
    LS_RANGE-LOW     = 'S_ADMI_FCD'
    LS_RANGE-HIGH     = 'S_ADMI_FCD'
    COLLECT LS_RANGE INTO LT_RANGE.
    SELECT *
               FROM UST12
               INTO CORRESPONDING FIELDS OF TABLE LT_OBJECT_VALUES
               WHERE FIELD IN LT_RANGE
               AND AKTPS   = 'A'.
    For options like BT(Between), EQ(Equal) in range table, this above query is executing without dump. But for option CP, it simply dumps & in dump what i found is, it is concatenating the value in low & high.
    Does anyone have any idea regarding open sql using range tables.
    Thanks,
    Bhupinder

    Hi,
    I commented as follows:
    If  LS_RANGE-HIGH is empty, you can use EQ, NE, GT, LE, LT,CP, and NP. These operators are the same as those that are used for logical expressions. Yet operators CP and NP do not have the full functional scope they have in normal logical expressions. They are only allowed if wildcards ( '*' or '+' ) are used in the input fields. If wildcards are entered on the selection screen, the system automatically uses the operator CP.
    If  LS_RANGE-HIGH  is filled, you can use BT (BeTween) and NB (Not Between). These operators correspond to BETWEEN and NOT BETWEEN that you use when you check if a field belongs to a range. You cannot use wildcard characters.
    You can try:
    CLEAR LS_RANGE.
    LS_RANGE-SIGN = 'I'.
    +LS_RANGE-OPTION = 'CP' +
    LS_RANGE-LOW = 'S_ADMI_FCD'.
    LS_RANGE-HIGH = 'S_ADMI_FCD'.
    FIND '*' IN LS_RANGE.
    IF sy-subrc = 0.
      LS_RANGE-OPTION = 'CP'.
    ELSE.
      LS_RANGE-OPTION = 'EQ'.
    ENDIF.
    COLLECT LS_RANGE INTO LT_RANGE.
    SELECT *
    FROM UST12
    INTO CORRESPONDING FIELDS OF TABLE LT_OBJECT_VALUES
    WHERE FIELD IN LT_RANGE
    AND AKTPS = 'A'.
    If you use wildcards the LS_RANGE  length should not exceed 10 characters.
    Hope this information is help to you.
    Regards,
    José

  • Display the sql statement with arguments with ojdbc14_g.jar

    Hi,
    I'd like to display the sql statements with ojdbc14_g.jar.
    So I've followed the documentation and set an OracleLog.properties file which is linked to my java program.
    The problem is the trace generated is huge and I only need the SQL requests wich are made with the arguments but I don't know how to configure that.
    Have you got a sample file which handle that ?
    I've tried that :
    oracle.jdbc.handlers=java.util.logging.ConsoleHandler
    java.util.logging.ConsoleHandler.level=CONFIG
    java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
    oracle.level=INFO
    oracle.jdbc.driver.level=OFF
    oracle.jdbc.driver.OraclePreparedStatement.level=OFF
    oracle.jdbc.pool.level=OFF
    oracle.jdbc.util.level=OFF
    oracle.sql.level=INFO
    But that doesn't display only the SQL and args :(
    Regards.

    The fact is the statement are made by ejb entities on JBoss so I don't have a way to make specific logger to display the sql order. The only thing I can do is to set the log4j org.jboss.ejb.plugins.cmp to a trace level in order to see the sql order but without the arguments.
    I tried those traces however I see stuff like that without any SQL orders :
    <<
    10:10:53,833 INFO [STDOUT] NFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=VIEW_ACTION_NAMES)
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=PROCESS_TYPE_HIERARCHY)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=PROCESS_TYPE_HIERARCHY)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=FORM_EMBEDDED_VIEWS)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=FORM_EMBEDDED_VIEWS)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 20>>

  • Dynamic SQL Statement with table name

    Dear all
    i like to have a SQL statement with a dynamic tablename. Is this possible? If yes, how?
    should be something like "select * from <mytablename>"
    Thank you
    Herbert

    Yes this is possible. use the below reference code for this.
    data: g_tablename type w_tabname,
            gv_dref TYPE REF TO data.
    FIELD-SYMBOLS: <g_itab> TYPE STANDARD TABLE.
    gv_tabname = p_tablename (take table name form selection screen or as per ur requirement)
    CREATE DATA gv_dref TYPE TABLE OF (g_tabname).
    ASSIGN gv_dref->* TO <g_itab>.
    now use the below select query to fetch the data
      SELECT * FROM (gv_tabname) INTO TABLE <g_itab>.
    Hope this will help

  • How to find sql statement with Unix process pid

    Hi
    how to find sql statement with Unix process pid
    is there any view to find that.
    please if so let me know
    Thanks in advance

    this is how I am doing this:
    oracle 7352340 7459066 0 07:47:10 - 0:00 oracleJDERED (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle 7459066 5386396 2 07:47:10 pts/1 0:01 sqlplus
    select sid,serial# from v$session where process='7459066';
    SID SERIAL#
    2178 6067
    select sql_text
    from
    v$sqlarea a,
    v$session b
    where a.hash_value = b.sql_hash_value
    and b.sid = 2178
    ;

  • SQL-Statement with OO4O

    Hello together,
    I post this Question here in
    Re: SQL-Statement with OO4O
    and i should paste my question again in an another database forum.
    now here again:
    I have here following Problem:
    Everthime I make a connection to my database with this code
    Set oSess = Server.CreateObject("OracleInProcServer.XOraSession")
    Set oDB = oSess.DbOpenDatabase(tnsname, user/PWD, 4)
    I get always this Statement in the DB-queue
    SELECT parameter, VALUE
    FROM SYS.nls_database_parameters
    WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET')
    Can me anyone tell me why I get this statement and how I can disable it?
    Best Regards
    Andy

    Hi,
    What can you do/change?I must ask next week my boss when he is back,
    what kind of changes I can do.
    Can you add a PL/SQL call to DBMS_APPLICATION_INFO into application?my boss must give me the permission to do a call to DBMS_APPLICATION_INFO.
    A way to identify the source of the badly behaving code is required; whether that be within the DB or external of it.I think so too.
    So please wait, until I have talk with my boss, than I will give you the answer you want. Sorry.
    Any other ideas, what I can do without call/changes on the database to find the problem?
    Best Regards
    Andy

  • Financial statement with Functional Area

    Dear Experts,
    We recently implemented SAP in our company.
    One problem we have is that our Financial statements are just on GL, our Management wants to see the Financial statement break up by departments (Cost centers) & Projects.
    I beleive that this is possible through Functional areas concept, but I don't know completely on how to configure & maintain Functional areas in order to get the Financial statements with Functional area.
    Please guide me a complete configuration step.
    Many Thanks.
    Sunil.

    Thanks Alice, but I partially disagree with your input.
    What is the benefit of maintaining Functional area in the Cost center master data then.
    I have seen some slides of Financial statements with Functional are break up by Cost center categories.
    Please give more idea on this.
    Thanks
    Sunil

  • SQL statement with union clause

    Hi,
    I have a scenario where i need to generate a sql statement with UNION .
    Eg:
    SELECT B.YY_ID,
    FROM XXXX.YY B
    WHERE (B.YY_TY= 'as')
    UNION
    SELECT B.YY_ID
    FROM XXXX.YY_ALT_NAME A, XXXX.YY B
    WHERE (A.YY_TY= 'zx'
    AND (B.YY_ID=A.YY_ID)"
    I tried ns1:table1() union ns3:table2() in XQuery.
    But it is pushdown as 2 seperate sqls.
    Is it possible to create XQuery that pushdown as SINGLE SQL statement with union clause ?
    Thanks

    No. See 3.1.1.5 in the document I referenced in your previous post.

  • How to Run SQL Tuning Advisor on the SQL statement with SQL_ID?

    Can you give the steps to run the SQL tuning advisor on the SQL statement with SQL_ID?
    Database version: 10g Release 2

    Hi,
    You can use either the automatic SQL tuning features that are accessible from Enterprise Manager Database Console on the "Advisor Central" page or trough SQL*PLUS using the DBMS_SQLTUNE pakage:
    -- creating the tuning task
    set serveroutput on
    declare
      l_sql_tune_task_id  varchar2(100);
    begin
      l_sql_tune_task_id := dbms_sqltune.create_tuning_task (
                              sql_id      => '<your_sql_id>',
                              scope       => dbms_sqltune.scope_comprehensive,
                              time_limit  => 60,
                              task_name   => '<your_tuning_task_name>',
                              description => 'tuning task for statement your_sql_id.');
      dbms_output.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    end;
    -- executing the tuning task
    exec dbms_sqltune.execute_tuning_task(task_name => '<your_tuning_task_name>');
    -- displaying the recommendations
    set long 100000;
    set longchunksize 1000
    set pagesize 10000
    set linesize 100
    select dbms_sqltune.report_tuning_task('<your_tuning_task_name>') as recommendations from dual;For more information, take a look at link provided by Jaffy.
    Cheers
    Legatti

  • Execute Stored Procedure SQL Statement with Parameter from Cell

    I would like to know if there is a way to pass the parameters to SQL Statement of Power Query. For example, I have a SQL Statement as follows:
    EXEC [dbo].[spReportBuilder]
    @Report = N'Revenue Summary',
    @Year = N'2014',
    @Period = N'11'
    I would like to know if it is possible to pass the @Report, @Year, @Period values from cells in the workbook, preferably without vba.
    Thanks

    rtisserand, 
    Here is the M code: 
    let
    IDValue = Excel.CurrentWorkbook(){[Name="YearTable"]}[Content],
    Source = Sql.Database("localhost", "AdventureWorks2012", [Query="EXEC [dbo].[spReportBuilder] @Report = N'Revenue Summary', @Year = N'" & Number.ToText(IDValue[ID]{0}) & "', @Period = N'11'"])
    in
    Source
    Some notes:
    You have to reference the excel query from another step in the query or you will get the following error: 
    Formula.Firewall: Query <>something<> references other queries or steps and so may not directly access a data source. Please rebuild this data combination.
    I only did the parameter for one value.
    Hope this helps.
    Reeves
    Denver, CO

  • Regular Expression functions not supported in Interactive report filters ??

    I'm using APEX 4.0.2 and I'm trying to create a row filter in an interactive report which uses regexp_instr and regexp_replace functions and I'm getting the message:
    Invalid filter expression. regexp_instr
    The code runs fine in SQL Workshop
    select cytogenetics from z_patient
    where regexp_instr(regexp_replace(cytogenetics,'(\,+|\"+|\s)',''),'(^46XX$|^46XY$|^46XX\[..\]$|^46XY\[..\]$)')=1
    CYTOGENETICS
    "46,XX [20]"
    "46,XY[20]"
    "46,XX"
    "46,XY[20]"
    "46,XY[30]"
    "46,XY[26]"
    "46,XY [33]"
    "46,XX[32]
    etc...
    my filter is just the where clause above i.e.
    regexp_instr(regexp_replace(cytogenetics,'(\,+|\"+|\s)',''),'(^46XX$|^46XY$|^46XX\[..\]$|^46XY\[..\]$)')=1
    *Are regular expression functions just not supported in interactive report filters?*
    thanks in advance
    Paul P

    Hi Paul,
    regular expression functions are supported in interactive report filters, but it looks like that REGEXP_INSTR hasn't been added as valid command. Only REGEXP_SUBSTR and REGEXP_REPLACE are valid commands for computation expressions and REGEXP_SUBSTR, REGEXP_REPLACE and REGEXP_LIKE for row level filters.
    I have filed bug# 12926266 to fix this issue. Sorry for the inconvenience.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • SQLEXEC not able to filter extract on sql statement or function call.

    hi all,
    i'm trying to do some basic extract filtering using a stored function and am not having much success.
    i started off using a procedure call but have been unsuccessful getting that working, i've simplified
    it to use a sql statement calling a function for a value to filter on, but cannot even get that to work.
    i've read through the documentation and i cannot figure out what is going wrong.
    any help would be much appreciated.
    thx,
    daniel
    function code is very simple, just trying to get something working.
    FUNCTION f_lookup_offer_id(v_offer_id IN offer.offer_id%TYPE)
    RETURN company.name%TYPE IS
    lv_company_name company.name%TYPE;
    BEGIN
    SELECT c.name
    INTO lv_company_name
    FROM orders a, offer b, company c
    WHERE a.offer_id = b.offer_id
    AND b.company_id = c.company_id
    AND a.order_id = v_order_id;
    RETURN lv_company_name;
    END f_lookup_offer_id ;
    Oracle GoldenGate Command Interpreter for Oracle
    Version 11.1.1.0.0 Build 078
    Solaris, sparc, 64bit (optimized), Oracle 10 on Jul 28 2010 13:26:39
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    EXTRACT EATUOP1
    INCLUDE ./dirprm/GGS_LOGIN.inc
    EXTTRAIL ./dirdat/up
    DISCARDFILE ./dirout/eatuop1.dsc, append , MEGABYTES 50
    DISCARDROLLOVER ON SUNDAY AT 06:00
    -- Database and DDL Options
    -- Added to avoid errors when setting unused columns
    DBOPTIONS ALLOWUNUSEDCOLUMN
    -- Get full row for deletes
    NOCOMPRESSDELETES
    -- Get updates before
    GETUPDATEBEFORES
    -- If commit SCN that is not greater than the highest SCN already processed error
    THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 15000 IOLATENCY 6000
    -- Retains original timestamp. Currently using GMT
    NOTCPSOURCETIMER
    --TABLE DEFS
    TABLE master.OFFER,
    SQLEXEC ( ID ck_offer,
    QUERY " select master.f_lookup_offer_id(:off_id) is_company from dual ",
    PARAMS (off_id = offer_id),
    BEFOREFILTER),
    FILTER (@GETVAL (ck_offer.is_company = "Google, Inc."));
    does not give any errors, but also does not capture any data, it's filtering everything out and trail files are empty, minus a header.
    thoughts or help?
    2012-04-04 22:17:36 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, eatuop1.prm: EXTRACT EATUOP1 started.
    2012-04-04 22:17:36 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery initialization completed for target file ./dirdat/up000022, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Output file ./dirdat/up is using format RELEASE 10.4/11.1.
    2012-04-04 22:17:36 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Rolling over remote file ./dirdat/up000022.
    2012-04-04 22:17:36 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for target file ./dirdat/up000023, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for all targets.
    2012-04-04 22:17:36 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Position of first record processed Sequence 13469, RBA 21894160, SCN 1789.722275534, Apr 4, 2012 10:12:40 PM.
    -rw-rw-rw- 1 svc_ggs 502 978 Apr 4 22:17 up000023

    got it working, this seems to be about as simple as i could formulate it. thanks for pointing me in the right direction.
    TABLE GGS_TEST_EXT, &
    SQLEXEC ( ID co_count, &
    QUERY " select f_lookup_company_name(:P1) x from dual ", &
    PARAMS ( P1 = company_id), BEFOREFILTER), &
    FILTER ( @GETVAL (co_count.x = 0) );
    then i have a function that returns 1 or 0, depending on the company id passed in.
    thx,
    daniel

  • Error with function returning "multiple" values

    Hi
    i am trying to write a function to return "multiple" values
    however, it returned the following error during compilation
    Compilation errors for FUNCTION sch1.myfn
    Error: PLS-00382: expression is of wrong type
    Line: 19
    Text: RETURN V_res;
    Error: PL/SQL: Statement ignored
    Line: 19
    Text: RETURN V_res;
    ques :
    1 - is there a need to always declare a table ? as it'll only return a single record with multiple columns
    CREATE OR REPLACE TYPE result as table of result_t;
    CREATE OR REPLACE TYPE result_t as object
    (user varchar2(100), comments varchar2(4000));
    CREATE OR REPLACE FUNCTION myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) RETURN result IS
    type V_res_t is RECORD (user varchar2(100), comments varchar2(4000));
    V_res V_res_t;
    BEGIN
    select a.user, a.comment
    into V_res.user, V_res.comments
    from view1     A,
    (select distinct id,
    begin_time,
    max(time) over(order by time desc) max_time from view2 b
    where id = IN_LOTID
    and begin_time = IN_BEGIN) b
    where a.id = b.id
    and a.begin_time = b.begin_time
    and a.time = max_time
    and a.id = IN_ID
    and a.begin_time = IN_BEGIN;
    RETURN V_res; --> this is the line that the system keep complaining
    END;
    Note : pls ignore whether the return results is correct but i am expecting it to always return a single row
    pls advise
    tks & rgds

    And if you really want to return a type as a table of, work with PIPELINED function :
    SQL> CREATE OR REPLACE TYPE result_t as object
      2  (user# varchar2(100), comments varchar2(4000));
      3  /
    Type created.
    SQL> CREATE OR REPLACE TYPE result as table of result_t;
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) RETURN result
      2  pipelined is
      3  user# varchar2(100);
      4  comments varchar2(4000);
      5  BEGIN
      6  pipe row (result_t(user#,comments));
      7  return;
      8  END;
      9  /
    Function created.
    SQL>PS: there is non sense to use pipelined function in my example, it is just an example to return a type as table.
    Nicolas.

Maybe you are looking for

  • Regarding ibot implementation in obiee 11g

    Hi All, i followed some links to configure ibots . when i run it i get the error shown below. AgentID: /users/weblogic/test_ibot Invalid subscribers skipped: weblogic AgentID: /users/weblogic/test_ibot Device (dashboard) is not set in (weblogic) deli

  • Capturing plots using GPIB-Equipped PC

    I would like to write a visual basic program to make the PC pretend to be a GPIB printer. Using Visual Basic, I can send commands to the spectrum analyser and get back simple pieces of information such as the marker frequency. But I have not been suc

  • Does earlier version of elements need to be uninstalled before installing PSE13?

    does earlier version of elements need to be uninstalled before installing PSE13?

  • OS crashed and cannot switch to console model when logout from gnome

    after update gnome to 3.2,  when I logout login account or switch user with gnome. the os dead. I have to reset pc to reboot it. should this isskue relate to gnome update?

  • Join Group

    I am a student at RBI in Rochester NY, I would like to be able to run my school work on my system at home, which will make my class room time more productive. Any ideas from any an all will be looked into. Thanks guys/gals