Oracle Spatial operator SQL statement help

I have a 3D elevation point feature class (elev) and a polygon feature class (Building) loaded in Oracle Spatial. I am trying to update the "HEIGHT" attribute of the "Building" Feature class using the average elevation of "elev" feature class. Here below is the SQL statement I used, which generated the same value for all buildings. The avg(elevation) returns the average elevation of all points within all building polygons, not all points within ONE polygon.
Please help and thanks.
update building
set height = (select avg(elevation)
from elev e, building b
where sdo_anyinteract(e.shape, b.shape) = 'TRUE');

Hi,
try this
update building b
set height = (select avg(elevation)
from elev e where sdo_anyinteract(e.shape, b.shape) = 'TRUE');
Udo

Similar Messages

  • Oracle 7 - Maximum SQL statement length

    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch44.htm#288033
    Like above, maximum SQL Statement Length is clearly defined on the "Reference" document of Oracle 8, 9, and 10.
    But I could not find it for Oracle 7.
    Can someone help me?

    This info is available in the Oracle 7 Server Reference. It can be found via http://otn.oracle.com/documentation. Look at the "Previously Released Oracle Documentation" to access it. It's a pdf. Here's a direct link: http://download-uk.oracle.com/docs/pdf/A32589_1.pdf. The details can be found in chapter 5.
    It comes down to this: 64k.
    MHE

  • Oracle to T-SQL statement

    Short version of a long story. I am trying to use T-SQL to write a number of create statements to be used in an Oracle database. The Oracle statement that I would use to get the output I am looking for is:
    select 'comment on column someschema.'||table_name||'.'||column_name||' is '''||comments||''';'
    from dba_col_comments
    where comments is not null
    and owner ='SOMESCHEMA'
    order by table_name;
    However, my feeble attempts (based on numerous web searches, I am an Oracle DBA, not SQL Server) have produced this so far:
    SELECT 'comment on column someschema.'+B.TABLE_NAME+'.',A.objname+' '''+cast(A.value as varchar)+''';' as value
    FROM fn_listextendedproperty('MS_DESCRIPTION','schema','dbo','table','SOMETABLE','column',default)
    as A, INFORMATION_SCHEMA.TABLES as B
    where value is not null
    GO
    This does not produce the output I need. This requires that I explicitly provide the table name for each table. I want this to be pulled dynamically as in the Oracle code. It also complains when I try to concatenate the '.' and A.objname with a +.
    It only runs when I put that into a separate column using the comma.
    I appreciate any suggestions anyone can provide.

    kalffiend,
    check if this works :
    --check this
    SELECT 'comment on column '+ sch.name+'.'+t.name+'.'+c.name+' is"'+ cast(value as varchar)+'";'
    FROM sys.extended_properties AS ep
    INNER JOIN sys.objects AS t ON ep.major_id = t.object_id
    INNER JOIN sys.schemas sch ON sch.schema_id=t.schema_id
    INNER JOIN sys.columns AS c ON ep.major_id = c.object_id
    AND ep.minor_id = c.column_id
    WHERE class = 1
    (couldn't test sorry)
    check this as well fr reference:
    http://technet.microsoft.com/en-us/library/ms186989(v=sql.105).aspx
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Oracle Date in SQL Statement.

    Hello,
        We are having performance issues with some reports using conditions on date fields in the Record Selection Formula. Our application does not use the time portion of the date fields very often. When Crystal Reports builds the SQL statement to Oracle it uses a range condition to include all the possible time values. This practice makes a big difference compared to a direct condition
         Example:   SELECT "TABLE_A"."ID"
                           FROM   "TABLE_A"
                           WHERE  ("TABLE_A"."DT">= TO_DATE('2011-03-31 00:00:00','YYYY-MM-DD HH24:MI:SS') AND
                                          "TABLE_A"."DT"< TO_DATE('2011-04-01 00:00:00','YYYY-MM-DD HH24:MI:SS'))
         Is there a way to tell Crystal not to perform range validation on dates?
         We would like to have a SQL Statment that looks like:
                           SELECT "TABLE_A"."ID"
                           FROM   "TABLE_A"
                           WHERE  ("TABLE_A"."DT" = TO_DATE('2011-03-31'))
        We are on Oracle 11 with Crystal Report for VS2010 Sp1.
    Thank you.
    Charles

    Have a look at the kbase below. I think this is a throwback to the fact that we can't handle the milliseconds in the DateTime. So, in order to ensure we get the correct data we search on a range plus one second of what you asked for.
    [1217417 - SQL query shows '&lt;' for a DateTime field filter although '&lt;=' was selected |http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333433313337%7D.do]

  • SQL statement help

    If someone would be so kind, I need help in formulating a SQL statement.
    Table A - employees(empoyee_id, employee_name, status)
    This table contains all employees
    employee status can be one of three values (A=active, T=temporary, I=inactive)
    Table B - savings_program(employee_id, plan_type)
    This table only has employee_id's of those that participate in a savings program (subset of all employees).
    plan_type can be one of three numeric values (30,35,40)
    I need SQL to report a.employee_id,a.employee_name,b.plan_type (return plan_type 30,35, or none)of all active employees in Table A that don't participate in Table B plan_type 40.
    Working with version 9iR2. Thanks!
    Edited by: fosterk on Nov 21, 2008 12:59 PM

    The tables and columns above were for demo purposes but actual code I'm trying is below. Please excuse me I'm more of an SA type so SQL is not my thing.
    As you can see from the first SQL statement below I know that I have exactly
    3,000 employees that meet this criteria. The second SQL statement is my attempt to return the rows I want (I'm just nesting it in a count(*) until the numbers look right)
    The last statement is what was given to me by someone else (seeking my help haha) trying to resolve it and it only returns 3 rows. This SQL shows the actual columns that we're trying to return from both tables.
    HR> select count(*) from ps_All_employees where empl_status != 'T'
    2 and emplid not in
    3 (select emplid from ps_savings_pt_vw where plan_type = 40)
    4 /
    COUNT(*)
    3000
    HR> select count(*) from (
    2 (select * from ps_all_employees where empl_status != 'T') a left outer join
    3 (select emplid from ps_savings_pt_vw where plan_type != 40) s
    4 on a.emplid = s.emplid
    5 )
    6 /
    COUNT(*)
    4587
    select count(*) from (
    select a.location, a.ssn, a.first_name, a.last_name, a.birthdate, a.orig_hire_dt, a.hire_dt, a.location, a.street1,
    a.street2, a.city, a.state, a.zip, s.plan_type
    from ps_all_employees a, ps_savings_pt_vw s
    where a.empl_status != 'T' and
    a.emplid = s.emplid and
    a.emplid not in (select s.emplid from ps_savings_pt_vw s where s.plan_type = 40)
    COUNT(*)
    3

  • Native SQL Statement help!

    Hi guys,
    I need some help here.
    I have a requirement to select from Microsoft SQL database
    Question
    How do I select with RANGE internal tables? As you can see, I have 4 range tables for this.
    BElow are my codes
    EXEC SQL.
        CONNECT TO 'CONNECTION_NAME'
      ENDEXEC.
      IF sy-subrc <> 0.
        MESSAGE 'Unable to connect to CONNECTION_NAME' TYPE 'E' DISPLAY LIKE 'I'.
        RETURN.
      ENDIF.
    * Define database cursor
      EXEC SQL.
        OPEN dbcur FOR
                SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
                       qty, zopcd, bstnk, wekunnr
                  FROM <TABLE_NAME>
                 WHERE month IN i_month
                   AND yyear IN i_year
                   AND kunnr IN i_kunnr
                   AND bstnk IN i_bstnk
      ENDEXEC.
    * Fill itab
      DO.
        EXEC SQL.
          FETCH NEXT dbcur INTO :l_dest-name1,
                                :l_dest-zvctk,
                                :l_dest-kunnr,
                                :l_dest-yyear,
                                :l_dest-mmonth,
                                :l_dest-matnr,
                                :l_dest-qty,
                                :l_dest-zopcd,
                                :l_dest-bstnk,
                                :l_dest-wekunnr
        ENDEXEC.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          APPEND l_dest TO it_dest.
        ENDIF.
      ENDDO.
    its giving me a shortdump
    >>>>>     OPEN dbcur FOR
       35             SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
       36                    qty, zopcd, bstnk, wekunnr
       37               FROM v_promise_sa
       38              WHERE month IN i_month[]
       39                AND yyear IN i_year[]
       40                AND kunnr IN i_kunnr[]
       41                AND bstnk IN i_bstnk[]
    Error message:
    Database error text........: "[Microsoft][SQL Server Native Client 10.0][SQL
    Server]Incorrect syntax near 'i_month'."
    Database error code........: 102
    Triggering SQL statement...: "SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
    qty, zopcd, bstnk, wekunnr FROM <TABLE_NAME> WHERE month IN i_month[] AND
    yyear IN i_year[] AND kunnr IN i_kunnr[] AND bstnk IN i_bstnk[]"
    Internal call code.........: "[DBDS/NEW DSQL]"
    Please check the entries in the system log (Transaction SM21).
    Can anyone guide me? If I do not enter the where clause, it is selecting fine.
    Appreciate it guys! Thanks in advance!

    lol, Come guys, don't judge me by just my forum nick man. It was just something random during registration a few years back...was indeed new in ABAP language :P
    But anyway, the table v_promimse_sa is not in the DDIC, its some microsoft MYSQL database or something.
    anyway what I did now:
    EXEC SQL.
        CONNECT TO 'MSSQL_PROMISE'
      ENDEXEC.
      IF sy-subrc <> 0.
        MESSAGE 'Unable to connect to MSSQL_PROMISE' TYPE 'E' DISPLAY LIKE 'I'.
        RETURN.
      ENDIF.
    * Define database cursor
      EXEC SQL.
        OPEN dbcur FOR
                SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
                       qty, zopcd, bstnk, wekunnr
                  FROM v_promise_sa
                 WHERE mmonth = :i_month
                   AND yyear  = :i_year
    *               AND ( kunnr BETWEEN :i_kunnr-low AND :i_kunnr-high )
    *               AND ( bstnk BETWEEN :i_bstnk-low AND :i_bstnk-high )
      ENDEXEC.
    * Fill itab
      DO.
        EXEC SQL.
          FETCH NEXT dbcur INTO :l_dest-name1,
                                :l_dest-zvctk,
                                :l_dest-kunnr,
                                :l_dest-yyear,
                                :l_dest-mmonth,
                                :l_dest-matnr,
                                :l_dest-qty,
                                :l_dest-zopcd,
                                :l_dest-bstnk,
                                :l_dest-wekunnr
        ENDEXEC.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          APPEND l_dest TO it_dest.
        ENDIF.
      ENDDO.
    *    EXEC SQL.
    *      CLOSE dbcur
    *    ENDEXEC.
      DELETE it_dest WHERE kunnr NOT IN i_kunnr
                       AND bstnk NOT IN i_bstnk.
    Well, after checking with the functional person, there are only 3 records so I guess the selection + filtering is working.

  • EarlyWatch - Expensive SQL Statements help

    Hi all,
    i need to analyze an EWA report and i don't know how exactly can i identify an "expensive SQL statement".
    The report says:
    During this session, the following expensive SQL statements were identified as causing a database load of at least 1%.
    The corresponding stored procedure names are referenced in the table below.
    And in the table with stored procedure names, a row looks like this:
    ID     Stored Procedure Name
    1     ##Y4DCWWES7EHY100000053960000254832042037
    What does it mean and how can i identify the name of program and the exact statement (probably select) that is causing this problem?
    Thank you,
    Ondrej

    Hi Ondrej,
    you're running on SQL Server. SAP creates stored procedures for each and every statement run against the database. The name you get seems to be a temporary stored procedure which (if I'm not wrong) is marked by the two # characters at the beginning. You may be still find it in the stored procedures of your system.
    Open the Enterprise Manager and open your database, then the stored procedure link (you should run the Enterprise Manager on the server or on a PC with enough RAM). The search for the procedure and double click on it. I think that should show you the SQL statement. There should also the report name is a comment.
    Regards
    Ralph

  • SQL statements:help

    here is a sample code of my application....
    int initialDelay = 10000; // start after 10 second
    int period = 10000*60*60*24*30; // repeat every month
    Timer timer = new Timer();
    TimerTask task = new TimerTask() {
    public void run() {
    try {
    MyDBConnection jdbc = new MyDBConnection();
    jdbc.init();
    Connection conn = jdbc.getMyConnection();
    Statement stmt = conn.createStatement();
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String[] tbl = {"emticket","emattachment","emhistory","emtracker"};
    progTxt.setText("");
    Logs l = new Logs();
    l.append("Auto Archive");
    date.getTime();
    //Archive data
    progTxt.append("\n\n");
    progTxt.append(" Archiving Data...\n ");
    stmt.execute("select * into outfile 'c:/emticket " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate()");
    stmt.execute("select * into outfile 'c:/emattachment " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emattachment where EmID in (select EmID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
    stmt.execute("select * into outfile 'c:/emhistory " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emhistory where TicketID in (select TicketID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
    stmt.execute("select * into outfile 'c:/emtracker " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emtracker where TicketID in (select TicketID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
    progTxt.append("Done.\n\n");
    //Delete data
    progTxt.append(" Deleting Data... ");
    stmt.execute("delete emticket, emattachment, emhistory, emtracker from emticket, emattachment, emhistory, emtracker where emattachment.EmID=emticket.EmID and emhistory.TicketID=emticket.TicketID and emtracker.TicketID=emtracker.TicketID and where RcvDateTime
    "_______"DATE_SUB(CURDATE(),INTERVAL 90 DAY) and CURDATE())");
    System.out.println(stmt.getUpdateCount());
    progTxt.append("Done.\n\n");
    Here's what i want to do....I want to backup file for the current date back to 3 mos...e.g 2007-05-23 down to 2007-02-23...then delete the remaining records...before"02-23-2007 to 05-23-2007"....this is where the query part i that doesn't work....
    Delete data
    progTxt.append(" Deleting Data... ");
    stmt.execute("delete emticket, emattachment, emhistory, emtracker from emticket, emattachment, emhistory, emtracker where emattachment.EmID=emticket.EmID and emhistory.TicketID=emticket.TicketID and emtracker.TicketID=emtracker.TicketID and where RcvDateTime
    "_______"DATE_SUB(CURDATE(),INTERVAL 90 DAY) and CURDATE())");
    System.out.println(stmt.getUpdateCount());
    progTxt.append("Done.\n\n")
    I tried putting <>=which means not equal in the "_____"but it fails to work..can somebody help me to work out with this query.

    I don't know MySQL, but shouldn't you just use <= ? I also don't understand what the final part 'and CURDATE()' is for...

  • SQL statement help needed

    I am sure some of you will laugh lol, but I am drawing a blank and need some assistance if anyone is willing to help:
    I have this query:
    SELECT DISTINCT ID
    FROM (SELECT productcode
    FROM sforce_product2
    WHERE productcode NOT LIKE 'DSXXX%'
    AND productcode NOT LIKE 'DO NOT USE%'
    AND productcode NOT LIKE 'MAXXXX%'
    AND isactive = 'true'
    MINUS
    SELECT productcode
    FROM vew_product_export) a,
    sforce_product2
    WHERE a.productcode = sforce_product2.productcode
    which returns 112 ID's (which is wrong)
    The inner SELECT statement:
    SELECT productcode
    FROM sforce_product2
    WHERE productcode NOT LIKE 'DSXXX%'
    AND productcode NOT LIKE 'DO NOT USE%'
    AND productcode NOT LIKE 'MAXXXX%'
    AND isactive = 'true'
    MINUS
    SELECT productcode
    FROM vew_product_export
    returns 106.
    Am I doing something simple wrong or is my query just mangled!
    TIA,
    Mike

      SELECT DISTINCT ID
        FROM (SELECT productcode
                FROM sforce_product2
               WHERE productcode NOT LIKE 'DSXXX%'
                 AND productcode NOT LIKE 'DO NOT USE%'
                 AND productcode NOT LIKE 'MAXXXX%'
                 AND isactive = 'true'
              MINUS
              SELECT productcode
                FROM vew_product_export) a,
              sforce_product2
       WHERE a.productcode = sforce_product2.productcodethe above code is returning an ID column which i think most probable from the sforce_product2 table
    while this query below returns the 106 value that is coming from the column productcode.
      SELECT productcode
        FROM sforce_product2
       WHERE productcode NOT LIKE 'DSXXX%'
         AND productcode NOT LIKE 'DO NOT USE%'
         AND productcode NOT LIKE 'MAXXXX%'
         AND isactive = 'true'
      MINUS
      SELECT productcode
        FROM vew_product_exportso i think there is nothing wrong because if you will review the 112 is from the column ID while the 106 is from the column productcode.

  • Generating hourly report from oracle database using sql developer .Help

    I am working on SQL Developer 1.5.1, i need to prepare hourly record of the activity on the database, for that i have a sql query that gives me the report as per selected columns on hourly basis.I need to prepare 24 reports a day.
    Each time i have to go to the query , change the date as per hours like form 22:06:2011 10:00:00 to 22:06:2011 11:00:00 and get the report and export it in excel.
    I want to automate the script so that whenever i run the script , it just asks me the date and runs the script 24 times and fetch me the hourly report of whole day.
    the query syntax is something like this
    Select
    from
    where
    And.......................
    And...................
    And......................
    And req date between to-date( 22:06:2011 10:00:00) And to-date(22:06:2011 11:00:00)
    Order by 7,1,2,3,4,5
    Is there any possibility that i can automate the script to automatically change the hour itself and generate a report in excel 24 times?please share if you have any idea on this.
    Looking forward for a response.

    This gives you data for the whole day and the first column tells you which hour data it is,
    SELECT 'HOUR' || TO_CHAR ( req_date, 'HH24') AS hour_num,
           col1,
           col2,
           col3
      FROM table_name
    WHERE TRUNC (req_date) = TO_DATE ( '22/06/2011', 'DD/MM/YYYY')G.

  • Simple SQl statement help needed!!!

    New to SQL..Please can you advice where is the problem..
    select file_id, a.file_name, a.sum(bytes/1024/1024) Used_space, b.sum(bytes/1024
    /1024) Free_space from dba_data_files a, dba_free_space b where tablespace_name
    ='DATA_TS' OR tablespace_name='INDEX_TS' OR tablespace_name='LOB_TS' group by fi
    le_id
    ERROR at line 1:
    ORA-00918: column ambiguously defined
    Thanks!

    Hi,
    Should you chose to format your SQL the problem is easily seen:
    SQL>select file_id
      2          ,a.file_name
      3          ,a.sum(bytes / 1024 / 1024) used_space
      4          ,b.sum(bytes / 1024 / 1024) free_space
      5      from dba_data_files a, dba_free_space b
      6     where tablespace_name = 'DATA_TS'
      7        or tablespace_name = 'INDEX_TS'
      8        or tablespace_name = 'LOB_TS'
      9  group by file_id;
    group by file_id
    ERROR at line 9:
    ORA-00918: column ambiguously defined
    SQL>So, which file_id do you want - a or b?
    Regards
    Peter

  • Oracle equivalent to SQL SERVER CLRClipString function

    Hello Friends,
    I am running the following sql query in SQL SERVER successfully ..
    select * from
    CLRSplitString('33,54,105,148,149,163,165,179,193,195,201,202,234,239,279,282,297,299,329,332,350,415,417,439,440,500,552,570,589,603,628,655', '', ',') x
    join dbo.PART_ADDL_INFO_NAMES_V v on x.col1 = v.addl_info_name_id
    I want to implement the same sql statement in ORACLE .
    I created the function that takes comma seperated string and display as single column .. I want to implemement in oracle as a sql statement ..
    create or replace function str2tbl
         (p_str in varchar2,
         p_delim in varchar2 default '.')
         return myTableType
    as
         l_str     long default p_str || p_delim;
         l_n     number;
         l_data myTableType := myTabletype();
    begin
         loop
         l_n := instr( l_str, p_delim );
         exit when (nvl(l_n,0) = 0);
         l_data.extend;
         l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
         l_str := substr( l_str, l_n+length(p_delim) );
         end loop;
         return l_data;
    end;
    DECLARE
    v_array mytabletype;
    BEGIN
    v_array := str2tbl ('10.01.03.04.234');
    FOR i IN 1 .. v_array.COUNT LOOP
         DBMS_OUTPUT.PUT_LINE (v_array(i));
    END LOOP;
    END;
    10
    01
    03
    04
    234
    appreciate your help ..
    thanks

    If you need to split a single string:
    with t as (
               select '33,54,105,148,149,163,165,179,193,195,201,202,234,239,279,282,297,299,329,332,350,415,417,439,440,500,552,570,589,603,628,655' str from dual
    select  regexp_substr(str,'[^,]+',1,level) sub_str
      from  t
      connect by level <= regexp_count(str,',') + 1
    SUB_STR
    33
    54
    105
    148
    149
    163
    165
    179
    193
    195
    201
    SUB_STR
    202
    234
    239
    279
    282
    297
    299
    329
    332
    350
    415
    SUB_STR
    417
    439
    440
    500
    552
    570
    589
    603
    628
    655
    32 rows selected.
    SQL> SY.
    P.S. REGEXP_COUNT is available in 11g only. If you are on 10g use:
    with t as (
               select '33,54,105,148,149,163,165,179,193,195,201,202,234,239,279,282,297,299,329,332,350,415,417,439,440,500,552,570,589,603,628,655' str from dual
    select  regexp_substr(str,'[^,]+',1,level) sub_str
      from  t
      connect by level <= length(regexp_replace(str,'[^,]')) + 1
    /

  • Add sql statements in SGA

    select a.address address,
    s.hash_value hash_value,
    s.piece piece,
    s.sql_text sql_text,
    u.username parsing_user_id,
    c.username parsing_schema_id
    from v$sqlarea a,
    v$sqltext_with_newlines s,
    dba_users u,
    dba_users c
    where a.address=s.address
    and a.hash_value=s.hash_value
    and a.parsing_user_id=u.user_id
    and a.parsing_schema_id=c.user_id
    and exists (select 'x'
    from v$sqltext_with_newlines x
    where x.address=a.address
    and x.hash_value=a.hash_value
    and upper(x.sql_text) like '%UNION%')
    order by 1,2,3
    On executing the above statement the server display list of sqltext present in sga. We know that the server first search for the record in sga and if it is not
    present in SGA it searches in data files.
    My question is ,adding all the sql statements in sga manually is advisable? will that improve the performance?

    Vinodh2 wrote:
    In production the users uses some sql statement frequently. So those statements should be in the sga for better performance. The dbms package said by you takes object as input. What is object here?
    Did you check the last line I pasted from document?
    The value for this identifier is the concatenation of the address and hash_value columns from the v$sqlarea view.Each SQL in SQL AREA has a hash_value to identify it. You can use this hash value to decide which SQL want to keep in shared pool.
    Having Dynamic sql statements(records fetched based on varying filter condtion) called from interfaces will not help.
    But having static sql statements helps.
    In that case how to include those sql.Like said, you are introducing some more problems instead of any real gain by trying to micro manage how shared pool work. You should let Oracle take care it with it's own algorithm. Unless some rare cases, that you have limited shared pool and super busy system you want to pin some SQL in the shared pool with provide package.

  • Using bind variables with sql statements

    We connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
    When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
    Is there anybody our there with an idea of what is happening here?
    Code snippet:
    Dim OraSession As OracleInProcServer.OraSessionClass
    Dim OraDatabase As OracleInProcServer.OraDatabase
    Set OraSession = CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
    OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
    OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
    OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
    Dim RS As OracleInProcServer.OraDynaset
    strSQLstatement= "Select * from my_table where igz= [my_bind] "
    Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
    OraDatabase.Parameters("my_bind").Value = myValue
    RS.Refresh
    Cheers and thanks a lot :)
    Michael Sonntag

    We connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
    When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
    Is there anybody our there with an idea of what is happening here?
    Code snippet:
    Dim OraSession As OracleInProcServer.OraSessionClass
    Dim OraDatabase As OracleInProcServer.OraDatabase
    Set OraSession = CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
    OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
    OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
    OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
    Dim RS As OracleInProcServer.OraDynaset
    strSQLstatement= "Select * from my_table where igz= [my_bind] "
    Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
    OraDatabase.Parameters("my_bind").Value = myValue
    RS.Refresh
    Cheers and thanks a lot :)
    Michael Sonntag

  • Precompiled SQL statement at client side ? (JDBC)

    Hi,
    Will Oracle support precompiled SQL statement for jdbc client ?
    Thanks

    A pre-compiled SQL statement on the client side makes absolutely no sense. Let's say the statement refers to system object id 1234 - the EMP table. But in the meantime the EMP table has been dropped and re-created as an index organised table and is now object id 7890.
    What about issues like scope, cost-based optimisation, etc?
    It honestly does not make the slightest sense to even want such a "pre-compiled client SQL" feature.
    > hmm.... Is there anyway to return the compiled SQL
    from database ?
    Yes - that is exactly what a cursor handle is. You give the database a SQL statement. It parses that and returns a SQL (aka cursor) handle for you to use and re-use.
    The typical (stateful) client would use the following template:
    -- open a database connection (usually returns a connection/session handle)
    hConnection = open DBconnection(params)
    -- parse/prepare a SQL statement (returns a SQL/cursor handle)
    hSQL = parseSQL( hConnection, 'INSERT INTO foo VALUES( :0, :1 )' )
    -- reuse the SQL statement
    while (Some_Condition)
    loop
    Some_Processing()
    -- bind values to the SQL statement variables
    SQLBind( hSQL, '0', var1)
    SQLBind( hSQL, '1', var2)
    -- execute the statement (it is not compiled or parsed again by the database)
    ExecSQL( hSQL )
    endloop

Maybe you are looking for

  • Ipod not being recognized by Itunes, yet appears on desktop.

    Earlier today I had my 80 gb ipod classic plugged into my ancient G4 Powerbook.  Everything was fine until the ipod accidently fell off of my desk.  In falling it had dislatched itself from the usb connection.  I had got the message on my computer sc

  • Trouble converting Word to PDF

    I have been using acrobat.com to convert word documents into PDF without a problem for about a month.  All of a sudden, today, when I tried to convert a Word document, it stalled and was "converting" for a very long time and would not ultimately conv

  • Error importing 11.2.0.1 export to 11.2.0.3

    Hi all, we have two machines. let's call them db_1 and db_2. db_1 has version 11.2.0.1, db_2 is a clone of db_! and has been updated by our dba to 11.2.0.3. Now I need move a schema with its data from db_1 to db_2. I used datapump for creating the ex

  • Improve Download Speed with Mobile Wireless Card

    I just purchased a GT MAX 3.6 Express LaptopConnect Card from AT&T to allow mobile internet access. While I can connect to the internet, the speed is very slow (I'm getting 3 of 7 bars). I understand there might be a Mac "booster" I can purchase. Has

  • GF3 TI 200 PRO VT VIDEO IN PROB

    I HAVE A GF3TI 200 PRO VT RUNNING ON WINDOWS ME. I HAVE INSTALLED ALL THE DETONATOR DRIVERS I CAN FIND, AND THE WDM DRIVERS AND TRIED THEM IN EVERY COMBINATION BUT YET I'M UNABLE TO GET VIDEO-IN FEATURE TO WORK. BUT ONLNY ONCE DID I GET IT WITH THE D