UTL_RAW

Hi
I installed oracle 8i in my server (windows nt). I installed
custom installation and everything is fine. Now I wanted to use
utl_raw package. But I could't find the package. If anybody know
how to install this package , please help me
regards
Santhosh
null

See the answer provided in the SQL forum.

Similar Messages

  • UTL_RAW.REVERSE for non english characters

    I'm trying to reverse a non-English work like the following and it does not work ....
    SELECT '中国' Original, UTL_RAW.cast_to_varchar2(UTL_RAW.REVERSE (UTL_RAW.cast_to_raw ('中国'))) Not_correctly_Reversed FROM DUAL;
    ORIGINAL NOT_CORRECTLY_REVERSED
    中国 ���
    Any thoughts please ?
    Appreciate responses. Thanks !

    chris227 wrote:
    Works well for meNo, it does not. It will fail if table has duplicate strings of two digit length but, what is even worse, it will produce wrong results if table has small duplicate strings:
    SQL> with testdata as (
      2                    select  '19 character string' str from dual union all
      3                    select  '19 character string' str from dual
      4                   )
      5  select distinct
      6    listagg(substr(str,level,1))within group ( order by level desc) over (partition by str) r
      7  from testdata
      8  connect by
      9  level <= length(str)
    10  and str = prior str
    11  and prior sys_guid() is not null
    12  /
    from testdata
    ERROR at line 7:
    ORA-01489: result of string concatenation is too long
    Elapsed: 00:00:36.08
    SQL> with testdata as (
      2                    select  'ABC' str from dual union all
      3                    select  'ABC' str from dual
      4                   )
      5  select distinct
      6    listagg(substr(str,level,1))within group ( order by level desc) over (partition by str) r
      7  from testdata
      8  connect by
      9  level <= length(str)
    10  and str = prior str
    11  and prior sys_guid() is not null
    12  /
    R
    CCCCCCCCBBBBAA
    Elapsed: 00:00:00.00You need to identify rows uniquely. With real table it is easy - rowid. With subquery factoring we need another view with, for example, ROW_NUMBER. However here we use subquery factoring to create sample table on-the-fly and assume OP will have real table. So I'd leave your example as is, but would let OP know to use:
    select distinct
      listagg(substr(str,level,1))within group ( order by level desc) over (partition by str) r
    from testdata
    connect by
    level <= length(str)
    and rowid = prior rowid
    and prior sys_guid() is not null
    /But this still will not work. Why? Same answer - duplicates:
    SQL> create table testdata as (
      2      select  'ABC' str from dual union all
      3      select  'ABC' str from dual
      4     );
    Table created.
    Elapsed: 00:00:00.42
    SQL> select distinct
      2    listagg(substr(str,level,1))within group ( order by level desc) over (partition by str) r
      3  from testdata
      4  connect by
      5  level <= length(str)
      6  and rowid = prior rowid
      7  and prior sys_guid() is not null
      8  /
    R
    CCBBAA
    Elapsed: 00:00:00.01
    SQL>Again, partition by str doesn't identify rows uniquery. We need to partition by rowid. But even this will not help:
    SQL> select distinct
      2    listagg(substr(str,level,1))within group ( order by level desc) over (partition by rowid) r
      3  from testdata
      4  connect by
      5  level <= length(str)
      6  and rowid = prior rowid
      7  and prior sys_guid() is not null
      8  /
    R
    CBA
    Elapsed: 00:00:00.00
    SQL>We got one row back instead of two. You probably put DISTINCT trying to resolve all these issues caused by building hierarchy and partitions on a non-unique bases. So now, when we identify rows uniquely by rowid, DISTINCT is not needed and should be replaced by GROUP BY (along with using aggregate LISTAGG instead of analytic LISTAGG). So final solution would be:
    select listagg(substr(str,level,1))within group ( order by level desc) r
    from testdata
    connect by
    level <= length(str)
    and rowid = prior rowid
    and prior sys_guid() is not null
    group by rowid
    R
    CBA
    CBA
    Elapsed: 00:00:00.00
    SQL>And with 19 character string:
    SQL> insert
      2    into testdata
      3  select  '19 character string' str from dual union all
      4                    select  '19 character string' str from dual;
    2 rows created.
    Elapsed: 00:00:00.00
    SQL> select listagg(substr(str,level,1))within group ( order by level desc) r
      2  from testdata
      3  connect by
      4  level <= length(str)
      5  and rowid = prior rowid
      6  and prior sys_guid() is not null
      7  group by rowid
      8  /
    R
    CBA
    CBA
    gnirts retcarahc 91
    gnirts retcarahc 91
    Elapsed: 00:00:00.00
    SQL>SY.

  • I sentance in UTL_RAW reference.

    Can someone explain what "it may actually be used in other environments" means in UTL_RAW section in Oracle® Database PL/SQL Packages and Types Reference
    11g Release 2 (11.2) E25788-04 ?
    It saids, "UTL_RAW is not specific to the database environment, and _*it may actually be used in other environments*_. For this reason, the prefix UTL has been given to the package, instead of DBMS."
    It seems there are reason why some package have DBMS_ and others have UTL_ and etc. It is kind of hard to find what are differences and why.
    Please explain it.
    Thank you in advance.

    For what purpose?
    This is a bit too vague to be able to help. Maybe you could read this...
    http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    Cheers
    Ben

  • Hi we are getting Errors in file /apps/oh2/diag/rdbms/bsdp12/BSDP122/trace/BSDP122_q01c_5899122.trc: ORA-00904: "UTL_RAW"."CAST_FROM_NUMBER": invalid identifier  alert in alertlog

    Errors in file /apps/oh2/diag/rdbms/bsdp12/BSDP122/trace/BSDP122_q01c_5899122.trc:
    ORA-00904: "UTL_RAW"."CAST_FROM_NUMBER": invalid identifier
    DB version 11.2.0,.4
    and Replication getting ab-ended with below error
      SourceLine         
    : [817]
    2015-03-29 14:07:12  ERROR   OGG-00665  OCI Error executing single row select (status = 26695-ORA-26695: error on call to dbms_lock.release: return code 4
    ORA-06512: at "SYS.DBMS_LOGREP_UTIL", line 197
    ORA-06512: at "SYS.DBMS_LOGREP_UTIL", line 240
    ORA-06512: at "SYS.DBMS_LOGREP_UTIL", line 493
    ORA-06512: at "SYS.DBMS_APPLY_ADM_INTERNAL", line 2375
    ORA-26790: Requesting a lock on set_dml_conflict_handler "" timed out
    ORA-06512: at "SYS.DBMS_XSTREAM_GG_ADM", line 335
    ORA-06512: at line 1), SQL<DECLARE   PRAGMA AUTONOMOUS_TRANSACTION;BEGIN   dbms_xstream_gg_adm.set_dml_conflict_handler(
    apply_name=>:1, source_object=>:2, object=>:
    3,
    conflict_handler_name=>:4, operation_name=>:5, conflict_type=>:6,
    method_name=>:7, column_list=>:8, resolution_column=>:9);END;>.
    Thanks

  • Strange behavior of UTL_RAW.CAST_TO_VARCHAR2

    Hi,
    When i execute below SQL, i get an exception "ORA-29275: partial multibyte character". Fine i understand this because the whole string is actually '7072C3A973656E74616E7420'.
    SELECT UTL_RAW.CAST_TO_VARCHAR2 ('7072C3') FROM dual;
    But when i put the same SQL within begin..end, it executes successfully. What could be the reason?
    Declare
      v_text varchar2(2000);
    begin
      --  7072C3A973656E74616E7420
    SELECT UTL_RAW.CAST_TO_VARCHAR2 ('7072C3') into v_text FROM dual;  
    dbms_output.put_line(v_text);
    end;
    Thanks
    Arul Jones

    If you look up the utl_raw.cast_to_varchar2 function, you will see that it requires a raw as an argument. You are passing it a string, which is impossible. So Oracle must implicitly attempt to cast your string into a raw before it can apply the function. Like this:
    orclz> select utl_raw.cast_to_raw('7072C3') from dual;
    UTL_RAW.CAST_TO_RAW('7072C3')
    373037324333
    orclz>
    Then you try to convert that back into a varchar2, which works if you do it explicitly:
    orclz> SELECT UTL_RAW.CAST_TO_VARCHAR2 (utl_raw.cast_to_raw('7072C3')) FROM dual;
    UTL_RAW.CAST_TO_VARCHAR2(UTL_RAW.CAST_TO_RAW('7072C3'))
    7072C3
    orclz>
    but this probably isn't what you want. When you rely on implicit type tasking, the results are often unpredictable. SQL is a strongly typed language, and you should respect this.

  • Utl_file.utl_raw adds a line feed at the end of the line. How to avoid it.

    utl_file.utl_raw adds a line feed at the end of the line. I have to send some binary files to my vendor and they do not want a line feed at the end of the line.
    When I execute the sample program below, it creates a file with a line feed(chr(10)) at the end of the line. When I do dump in hexa, it shows a character x0A
    How to avoid the line feed at end of line?
    We are using Oracle 9i on unix platform.
    declare
    l_output           utl_file.file_type;
    v_raw      raw(32767);
    v_trlr_rec_code      VARCHAR2(2);
    v_trlr_evnt_title      VARCHAR2(6);
    begin
    l_output := utl_file.fopen( 'RM_MHE_IN_DIR', 'abc.dat', 'w', 14 );
    v_trlr_rec_code      := '99';
    v_trlr_evnt_title      := 'STARTD';
    v_raw := HEXTORAW(v_trlr_rec_code) || utl_raw.cast_to_raw(v_trlr_evnt_title);
    utl_file.put_raw( l_output, v_raw );
    utl_file.fflush( l_output );
    utl_file.fclose( l_output );
    dbms_output.put_line( utl_raw.cast_to_varchar2( v_raw ) );
    EXCEPTION
    WHEN OTHERS THEN
         dbms_output.put_line( sqlerrm );
    end;
    /

    oops, sorry i overlooked the fact that the db is 9i; thanks for pointing it out Solomon.
    Not sure about this, but a workaround could be to remove the "\n" characters at the end of each line using one of the many Unix utilities after the file has been created.
    isotope

  • ORA-04062: signature of package "SYS.UTL_RAW" has been changed

    I have a form that was migrated from 6i to 10g.
    I get the following error in the form in 10g.( Not in 6i )
    ORA-04062: signature of package "SYS.UTL_RAW" has been changedIf I execute the same code from sqlplus in 10g. It works..no errors
    This is the code
    set serveroutput on
    Declare
       P_chksum  Varchar2(40);
    Begin
       P_chksum := DBMS_OBFUSCATION_TOOLKIT.MD5(input_string => 'P-STRS');
       dbms_output.put_line('P_chksum='||P_chksum);
       P_chksum := UTL_RAW.CAST_TO_RAW(P_chksum);
       dbms_output.put_line('P_chksum='||P_chksum);
    End;
    SQL> start test_cksum.sql
    P_chksum=Ì]\š#³³MÝÜ~Jèo²
    P_chksum=CC5D5C9A23B3B34DDDDC7E4AE86FB209
    PL/SQL procedure successfully completed.Any idea why I get this error in forms 10g only?
    Thanks

    Issue resolved. Something to do with compilation of the form.

  • Utl_raw.bit_and - how can I improve performance of this query?

    Hi all
    Hugely grateful for any light anyone can shed.
    I need to do bit AND operations on 128 bit numbers and I'm stuck in Oracle 10g.
    10g provides a very nice bitand() function that can be applied to numbers but it only works up to 64 bit numbers (actually only 62 I think because it needs a couple of bits)
    So I've been looking at using the utl_raw.bit_and function. It works very well, except that I'm encountering a massive performance hit, which hopefully is in the way I'm using it, rather than intrinsic to the speed at which utl_raw.bit_and itself performs..
    With numbers, I do a query like this:
    select count(1) from offer_a where bitand(bit_column, 51432) = 51432
    With utl_raw.bit_and (and 16-byte RAW column), I am passing in a hex value (may not be the best thing? Would passing in binary be better?) and doing my query like this:
    select count(1) from offer_a where utl_raw.bit_and(bit_column,hextoraw('00000000000000000020008000002ca1')) = hextoraw('00000000000000000020008000002ca1');
    One million rows using bitand takes about a second, using utl_raw.bit_and like this takes 25 seconds or so!!! Hopefully it's something in the way I'm calling it, and there's a faster way?
    Thank you!
    Jake

    Hmm.. Actually it may not be that simple.
    I had created an index on the number column that oracle seems to consistently use if I do a query like:
    select count(1) from scott.offer_b where
    current_price >= 0 and
    bitand(current_price, 9008574719100165) = 9008574719100165
    (without the >= oracle seems to do a full table scan. The reason I created the index is that there's other columns in the data table, making larger blocks. I figured that an index, even though most of needs to be scanned, would be faster because I can cram many more rows into each block..?).
    But if I drop the index on the number column, it takes about 12 secs/1m rows, in other words about half the time of the utl_raw.bit_and().
    So it's possible that bitand on 64 bits takes about half the time of utl_raw.bit_and on 128 bits, which is very reasonable..
    So maybe the real problem I have is why oracle is not using the equivalent index that I placed on the RAW column when I do:
    select count(1) from scott.offer_b where
    hex_bit_sig >= '00000000000000000020008000002ca1' and
    utl_raw.bit_and(hex_bit_sig,'00000000000000000020008000002ca1') = '00000000000000000020008000002ca1';
    (By the way I realized that I don't need to use the hextoraw - seems like just putting a hex number in '' is the right way to specify a raw anyway?)
    So yes, I think that's the real problem - how can I get oracle to use the index I created on the RAW value

  • UTL_RAW Documentation Errors

    In the summary of subprograms, there seems to be a miss-alignment of descriptions somewhere along the line.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/u_raw.htm#i996746
    i.e. In particular, these 3:
    CAST_TO_NVARCHAR2 Function..........Converts a RAW value into a VARCHAR2 value
    CAST_TO_RAW Function....................Converts a RAW value into an NVARCHAR2 value
    CAST_TO_VARCHAR2 Function...........Converts a VARCHAR2 value into a RAW value
    Ta,
    Trent

    Thanks for pointing out those errors. I've passed the information along to the appropriate writer.

  • Default Encrypted  Password

    Dear All,
    i want to insert encrypted Password of 'password' string into table user_dtl column PASSWORD .
    How can i insert Encripted password into table.
    Thanks

    Hi Vedant,
    See the CUSTOM_HASH function that is installed with sample application in the APEX.
    Here is the code for it:
    create or replace function custom_hash (p_username in varchar2, p_password in varchar2)
    return varchar2
    is
      l_password varchar2(4000);
      l_salt varchar2(4000) := 'XFSPL28ZTWEWWM6FHWMK68AG5NQVLU';
    begin
    -- This function should be wrapped, as the hash algorithm is exposed here.
    -- You can change the value of l_salt or the method of which to call the
    -- DBMS_OBFUSCATOIN toolkit, but you much reset all of your passwords
    -- if you choose to do this.
    l_password := utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5
      (input_string => p_password || substr(l_salt,10,13) || p_username ||
        substr(l_salt, 4,10)));
    return l_password;
    end;
    i want to insert encrypted Password of 'password' string into table user_dtl column PASSWORD.The above function will give the encrypted password which can be inserted into USER_DTL as follows:
    INSERT INTO USER_DTL(USERNAME,PASSWORD) VALUES(:P1_USERNAME, CUSTOM_HASH(:P1_USERNAME,:P1_PASSWORD))Be sure that PASSWORD column in USER_DTL is of type VARCHAR2 and of adequate length as to accommodate the encrypted password.
    Hope it helps!
    Regards,
    Kiran

  • Error While loading a image from database

    Purpose
    Error While loading the Image from the database
    ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
    ORA-06512: at "Sys.HTP" ,line 1480
    Requirement:
    I am developing the web pages using PSP(Pl/sql Serverpages) . I have a requirement to show a image in the webpage. I got the following procedures from the oracle website.
    I have created the following table to store the images
    create table DEMO
    ID INTEGER not null,
    THEBLOB BLOB
    And I also uploaded the Images. Now I am try to get a image from the table using the following procedure .But I am getting the error message line 25( htp.prn( utl_raw.cast_to_varchar2( l_raw ) );) .at it throws the following error messages
    ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
    ORA-06512: at "Sys.HTP" ,line 1480
    Procedure that I used to get the image
    create or replace package body image_get
    as
    procedure gif( p_id in demo.id%type )
    is
    l_lob blob;
    l_amt number default 30;
    l_off number default 1;
    l_raw raw(4096);
    begin
    select theBlob into l_lob
    from demo
    where id = p_id;
    -- make sure to change this for your type!
    owa_util.mime_header( 'image/gif' );
    begin
    loop
    dbms_lob.read( l_lob, l_amt, l_off, l_raw );
    -- it is vital to use htp.PRN to avoid
    -- spurious line feeds getting added to your
    -- document
    htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
    l_off := l_off+l_amt;
    l_amt := 4096;
    end loop;
    exception
    when no_data_found then
    NULL;
    end;
    end;
    end;
    What I have to do to correct this problem. This demo procedure and table that I am downloaded from oracle. Some where I made a mistake. any help??
    Thanks,
    Nats

    Hi Satish,
    I have set the raw value as 3600 but still its gives the same error only. When I debug the procedure its throwing the error stack in
    SYS.htp.prn procedure of the following line of code
    if (rows_in < pack_after) then
    while ((len - loc) >= HTBUF_LEN)
    loop
    rows_in := rows_in + 1;
    htbuf(rows_in) := substr(cbuf, loc + 1, HTBUF_LEN);
    loc := loc + HTBUF_LEN;
    end loop;
    if (loc < len)
    then
    rows_in := rows_in + 1;
    htbuf(rows_in) := substr(cbuf, loc + 1);
    end if;
    return;
    end if;
    Its a system procedure. I don't no how to proceed .. I am really stucked on this....is their any other method to take picture from the database and displayed in the web page.....???? any idea..../suggesstion??
    Thanks for your help!!!.

  • Need suggestion on STATSPACK report

    Problem:
         Application running Very slow that too not consistent.
         i am unable to find out where the problem persists.
         I have given necessary details and attached Statspack report with this mail.
         Need help very urgently...
    Database Info.
         Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
         PL/SQL Release 9.2.0.1.0 - Production
         CORE 9.2.0.1.0 Production
         TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
         NLSRTL Version 9.2.0.1.0 - Production
    System Information:
         Item                    Value
         OS Name                    Microsoft Windows 2000 Advanced Server
         Version                    5.0.2195 Service Pack 3 Build 2195
         OS Manufacturer               Microsoft Corporation
         System Name               NHOUSE
         System Manufacturer          HP
         System Model               ProLiant DL380 G3
         System Type               X86-based PC
         Processor               x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2384 Mhz
         Processor               x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2384 Mhz
         Windows Directory          C:\WINNT
         System Directory          C:\WINNT\System32
         Total Physical Memory          1,572,372 KB
         Available Physical Memory     865,600 KB
         Total Virtual Memory          5,086,520 KB
         Available Virtual Memory     3,755,652 KB
         Page File Space               3,514,148 KB
         Page File               C:\pagefile.sys
    Other Info:
         Shared Server Mode
         No. of Instance Running : 1(ST011)
         No. of Application running for this instance : 1 (Softtrack)
         Database Type : OLTP (Order Entry System with report generations)
         No of users : 2(Object Schema and AccessSchema)
    File Placement :
         All FIles placed in single disk since lack of disks.
    StatsPack report:
    STATSPACK report for
    DB Name DB Id Instance Inst Num Release Cluster Host
    ST011 1063661848 st011 1 9.2.0.1.0 NO NHOUSE
    Snap Id Snap Time Sessions Curs/Sess Comment
    Begin Snap: 41 07-Aug-03 09:37:30 15 4.3
    End Snap: 62 08-Aug-03 04:00:04 15 3.8
    Elapsed: 1,102.57 (mins)
    Cache Sizes (end)
    ~~~~~~~~~~~~~~~~~
    Buffer Cache: 136M Std Block Size: 8K
    Shared Pool Size: 168M Log Buffer: 512K
    Load Profile
    ~~~~~~~~~~~~ Per Second Per Transaction
    Redo size: 445.51 1,374.71
    Logical reads: 870.05 2,684.69
    Block changes: 2.11 6.51
    Physical reads: 15.05 46.44
    Physical writes: 4.02 12.42
    User calls: 16.13 49.78
    Parses: 5.49 16.93
    Hard parses: 0.89 2.76
    Sorts: 1.36 4.21
    Logons: 0.00 0.01
    Executes: 5.84 18.02
    Transactions: 0.32
    % Blocks changed per Read: 0.24 Recursive Call %: 57.93
    Rollback per transaction %: 50.19 Rows per Sort: 148.29
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Buffer Nowait %: 100.00 Redo NoWait %: 100.00
    Buffer Hit %: 99.01 In-memory Sort %: 99.59
    Library Hit %: 93.31 Soft Parse %: 83.72
    Execute to Parse %: 6.04 Latch Hit %: 99.99
    Parse CPU to Parse Elapsd %: 97.75 % Non-Parse CPU: 86.83
    Shared Pool Statistics Begin End
    Memory Usage %: 18.19 92.77
    % SQL with executions>1: 47.57 41.10
    % Memory for SQL w/exec>1: 44.60 42.30
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~ % Total
    Event Waits Time (s) Ela Time
    CPU time 1,025 46.80
    control file parallel write 21,433 558 25.48
    SQL*Net more data to client 495,625 181 8.27
    log file parallel write 12,335 102 4.64
    log file sync 10,697 89 4.06
    Wait Events for DB: ST011 Instance: st011 Snaps: 41 -62
    -> s - second
    -> cs - centisecond - 100th of a second
    -> ms - millisecond - 1000th of a second
    -> us - microsecond - 1000000th of a second
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    control file parallel write 21,433 0 558 26 1.0
    SQL*Net more data to client 495,625 0 181 0 23.1
    log file parallel write 12,335 12,030 102 8 0.6
    log file sync 10,697 1 89 8 0.5
    db file scattered read 75,969 0 81 1 3.5
    direct path read 210,093 0 66 0 9.8
    db file parallel write 2,480 1,240 51 21 0.1
    db file sequential read 19,775 0 21 1 0.9
    control file sequential read 17,629 0 6 0 0.8
    direct path write 774 0 5 7 0.0
    enqueue 9 0 2 231 0.0
    SQL*Net break/reset to clien 2,552 0 1 1 0.1
    log file sequential read 30 0 1 21 0.0
    db file single write 32 0 0 11 0.0
    switch logfile command 2 0 0 144 0.0
    control file single write 5 0 0 29 0.0
    log file single write 2 0 0 12 0.0
    LGWR wait for redo copy 78 1 0 0 0.0
    latch free 7 0 0 0 0.0
    async disk IO 13 0 0 0 0.0
    buffer busy waits 9 0 0 0 0.0
    reliable message 3 0 0 0 0.0
    undo segment extension 9 9 0 0 0.0
    SQL*Net message from client 1,067,763 0 116,054 109 49.8
    virtual circuit status 1,005,679 1,028 68,949 69 46.9
    jobq slave wait 786 753 2,403 3057 0.0
    SQL*Net more data from clien 5,972 0 4 1 0.3
    SQL*Net message to client 1,067,776 0 3 0 49.8
    Background Wait Events for DB: ST011 Instance: st011 Snaps: 41 -62
    -> ordered by wait time desc, waits desc (idle events last)
    Avg
    Total Wait wait Waits
    Event Waits Timeouts Time (s) (ms) /txn
    control file parallel write 21,376 0 556 26 1.0
    log file parallel write 12,335 12,030 102 8 0.6
    db file parallel write 2,480 1,240 51 21 0.1
    control file sequential read 13,975 0 3 0 0.7
    db file scattered read 220 0 1 3 0.0
    log file sequential read 30 0 1 21 0.0
    db file sequential read 231 0 1 2 0.0
    direct path write 8 0 0 7 0.0
    log file single write 2 0 0 12 0.0
    direct path read 8 0 0 3 0.0
    LGWR wait for redo copy 78 1 0 0 0.0
    log file sync 1 0 0 11 0.0
    rdbms ipc reply 42 0 0 0 0.0
    async disk IO 13 0 0 0 0.0
    buffer busy waits 4 0 0 0 0.0
    rdbms ipc message 89,265 77,930 400,950 4492 4.2
    smon timer 225 210 67,257 ###### 0.0
    SQL ordered by Gets for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Buffer Gets Threshold: 10000
    -> Note that resources reported for PL/SQL includes the resources used by
    all SQL statements called within the PL/SQL code. As individual SQL
    statements are also reported, it is possible and valid for the summed
    total % to exceed 100
    CPU Elapsd
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    3,329,463 78 42,685.4 5.8 33.84 40.89 2765271770
    select distinct s1.prospectna, s1.praddr1, s1.praddr2, s1.praddr
    3, s1.prcity, s1.prstate from (select distinct a.oanno as uoanno
    , decode(a.oanno,NUll,b.oandt,a.oandt) as uoandt, ltrim(rtrim(up
    per(prospectna))) prospectna, decode(praddr1,null,' ',ltrim(rtri
    m(upper(praddr1)))) as praddr1, decode(praddr2,null,' ',ltrim(rt
    2,150,915 78 27,575.8 3.7 34.70 231.25 1951422680
    select s1.* from (select distinct a.oanno as uoanno, decode(a.oa
    nno,Null,b.roanno,a.roanno) as uroanno, decode(a.oanno,NUll,b.oa
    ndt,a.oandt) as uoandt, decode(a.oanno,NUll,b.pono,a.pono) as up
    ono, decode(a.oanno,Null,b.podt,a.podt) as upodt, decode(a.oanno
    ,Null,upper(b.npsloffice),upper(a.npsloffice)) as npsl, decode(a
    967,504 387 2,500.0 1.7 3.25 3.32 1647834759
    select * from (select null table_catalog, ac.owner table_schema,
    ac.table_name table_name, acc.column_name column_name, null col
    umn_guid, null column_propid, acc.position ordinal, ac.constrain
    t_name pk_name from all_constraints ac, all_cons_columns acc whe
    re ac.owner=acc.owner and ac.constraint_type='P' and ac.constrai
    869,555 24 36,231.5 1.5 11.56 54.15 569094110
    select workorderno, workorddt, a.oanno as uoanno, decode(b.oanno
    ,Null,a.oandt, b.oandt) as uoandt, decode(b.oanno,Null,a.roanno,
    b.roanno) as uroanno, decode(b.oanno,Null,a.pono,b.pono) as up
    ono,decode(b.oanno,null,a.podt,b.podt) as upodt, decode(b.oanno
    ,Null,upper(a.npsloffice),upper(b.npsloffice)) as npsl,decode(b.
    821,376 24 34,224.0 1.4 8.73 11.09 1011529824
    select distinct ltrim(rtrim(upper(prospectna))) prospectna, deco
    de(praddr1,null,' ',ltrim(rtrim(upper(praddr1)))) pr1, decode(pr
    addr2,null,' ',ltrim(rtrim(upper(praddr2)))) pr2, decode(pradd
    r3,null,' ',ltrim(rtrim(upper(praddr3)))) pr3, decode(prcity,nul
    l ,' ', ltrim(rtrim(upper(prcity)))) prcity, decode(prstate,nul
    774,701 30 25,823.4 1.3 10.50 26.76 2315633148
    select a.oanno as uoanno,a.roanno as uroanno,a.oandt as uoandt,
    a.pono as upono,a.podt as upodt,upper(a.npsloffice) as npsl,dec
    ode(d.delicity,null,'NOT AVAILABLE',UPPER(d.delicity)) as dely,
    ltrim(rtrim(upper(prospectna))) prospectna, decode(praddr1,null
    ,' ',ltrim(rtrim(upper(praddr1)))) as pr1, decode(praddr2,null,'
    761,959 30 25,398.6 1.3 7.63 8.27 1655857706
    select distinct ltrim(rtrim(upper(prospectna))) prospectna,ltrim
    (rtrim(upper(praddr1))) praddr1,ltrim(rtrim(upper(praddr2))) pra
    ddr2,ltrim(rtrim(upper(praddr3))) praddr3,ltrim(rtrim(upper(prci
    ty))) prcity,ltrim(rtrim(upper(prstate))) prstate from softdb.
    oandetails a, softdb.oanudetails b, softdb.enquiryform, softdb.
    650,627 21 30,982.2 1.1 6.92 7.12 4059808258
    SQL ordered by Gets for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Buffer Gets Threshold: 10000
    -> Note that resources reported for PL/SQL includes the resources used by
    all SQL statements called within the PL/SQL code. As individual SQL
    statements are also reported, it is possible and valid for the summed
    total % to exceed 100
    CPU Elapsd
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    Module: SQL*Plus
    INSERT into stats$sqltext ( hash_value
    , text_subset , piece
    , sql_text , address , comman
    d_type , last_snap_id )
    select st1.hash_value , ss.text_subset
    397,508 159 2,500.1 0.7 1.64 1.57 1524142529
    select * from (select null table_catalog, ac.owner table_schema,
    ac.table_name table_name, acc.column_name column_name, null col
    umn_guid, null column_propid, acc.position ordinal, ac.constrain
    t_name pk_name from all_constraints ac, all_cons_columns acc whe
    re ac.owner=acc.owner and ac.constraint_type='P' and ac.constrai
    289,960 144,980 2.0 0.5 10.75 9.52 2091761008
    select condition from cdef$ where rowid=:1
    287,552 9 31,950.2 0.5 0.00 13.58 2301846564
    DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate;
    broken BOOLEAN := FALSE; BEGIN statspack.snap; :mydate := next_d
    ate; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;
    115,275 169 682.1 0.2 0.81 0.89 1682770808
    select * from (select null table_catalog, idx.table_owner table_
    schema, idx.table_name table_name, null index_catalog, idx.owner
    index_schema, idx.index_name index_name, null primary_key, deco
    de(idx.uniqueness, 'UNIQUE', 65535, 0) unique_, decode(idx.index
    type, 'CLUSTER', 65535, 0) clustered, null type, null fillfact
    95,008 38 2,500.2 0.2 0.39 0.36 3969207777
    select * from (select null table_catalog, ac.owner table_schema,
    ac.table_name table_name, acc.column_name column_name, null col
    umn_guid, null column_propid, acc.position ordinal, ac.constrain
    t_name pk_name from all_constraints ac, all_cons_columns acc whe
    re ac.owner=acc.owner and ac.constraint_type='P' and ac.constrai
    85,527 1 85,527.0 0.1 3.14 4.49 2005338978
    BEGIN :RET_VAL := DBMS_METADATA.FETCH_CLOB(:HANDLE);
    END;
    85,314 1 85,314.0 0.1 3.13 4.30 3633453749
    SELECT VALUE(KU$) XMLSCHEMA_T FROM SYS.KU$_XMLSCHEMA_VIEW KU$ WH
    ERE KU$.OWNER_NAME='SOFTDB'
    55,861 1 55,861.0 0.1 0.66 1.51 2026512687
    select s1.* from (select a.oanno as uoanno, decode(a.oanno,NUll,
    SQL ordered by Reads for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Disk Reads Threshold: 1000
    CPU Elapsd
    Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
    37,620 78 482.3 3.8 34.70 231.25 1951422680
    select s1.* from (select distinct a.oanno as uoanno, decode(a.oa
    nno,Null,b.roanno,a.roanno) as uroanno, decode(a.oanno,NUll,b.oa
    ndt,a.oandt) as uoandt, decode(a.oanno,NUll,b.pono,a.pono) as up
    ono, decode(a.oanno,Null,b.podt,a.podt) as upodt, decode(a.oanno
    ,Null,upper(b.npsloffice),upper(a.npsloffice)) as npsl, decode(a
    10,262 21 488.7 1.0 7.86 20.17 1017492279
    Module: SQL*Plus
    INSERT into stats$sql_summary ( snap_id
    , dbid , instance_number , text_subset
    , sharable_mem , sorts , modu
    le , loaded_versions , fetches
    , executions , loads , invalidations
    10,249 22 465.9 1.0 7.70 20.12 2734029811
    Module: SQL*Plus
    INSERT into stats$sql_statistics ( snap_id
    , dbid , instance_number , total_
    sql , total_sql_mem , single_use_sql
    , single_use_sql_mem ) select :
    b3 , :b2 , :b1 , count(1)
    6,164 24 256.8 0.6 11.56 54.15 569094110
    select workorderno, workorddt, a.oanno as uoanno, decode(b.oanno
    ,Null,a.oandt, b.oandt) as uoandt, decode(b.oanno,Null,a.roanno,
    b.roanno) as uroanno, decode(b.oanno,Null,a.pono,b.pono) as up
    ono,decode(b.oanno,null,a.podt,b.podt) as upodt, decode(b.oanno
    ,Null,upper(a.npsloffice),upper(b.npsloffice)) as npsl,decode(b.
    3,625 30 120.8 0.4 10.50 26.76 2315633148
    select a.oanno as uoanno,a.roanno as uroanno,a.oandt as uoandt,
    a.pono as upono,a.podt as upodt,upper(a.npsloffice) as npsl,dec
    ode(d.delicity,null,'NOT AVAILABLE',UPPER(d.delicity)) as dely,
    ltrim(rtrim(upper(prospectna))) prospectna, decode(praddr1,null
    ,' ',ltrim(rtrim(upper(praddr1)))) as pr1, decode(praddr2,null,'
    3,582 7 511.7 0.4 0.17 1.10 2255532526
    delete from softdb.oanaddr where oanno not in (select oanno from
    softdb.oanitem where regndt='07-Aug-2003' and regnno='00CHEN00
    23120' and qtndt='07-Aug-2003' and qtnno='00CHEN0023120') and r
    egndt='07-Aug-2003' and regnno='00CHEN0023120' and qtndt='07-Au
    g-2003' and qtnno='00CHEN0023120'
    3,110 8 388.8 0.3 1.39 17.41 2559037884
    select a.itemdesc, a.mcslno, a.oanno, a.oandt, a.itemsrlno from
    softdb.keytab a, softdb.oanups b where a.oanno = b.oanno(+) and
    a.oandt = b.oandt(+) and a.itemsrlno = b.itemsrlno(+) and b.oann
    o is null union select a.itemdesc, a.mcslno, a.oanno, a.oandt, a
    .itemsrlno from softdb.keytab a, softdb.oanups b where a.oanno
    2,359 7 337.0 0.2 0.14 0.44 2169388924
    delete from softdb.commdeliaddr where regndt='07-Aug-2003' and r
    egnno='00CHEN0023120' and qtndt='07-Aug-2003' and qtnno='00CHEN0
    SQL ordered by Reads for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Disk Reads Threshold: 1000
    CPU Elapsd
    Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
    023120' and commid not in (select commid from softdb.commdeliite
    ms where regndt='07-Aug-2003' and regnno='00CHEN0023120' and qtn
    dt='07-Aug-2003' and qtnno='00CHEN0023120')
    1,963 7 280.4 0.2 0.27 2.61 3352066490
    delete from softdb.oanlevy where oanno not in (select oanno fro
    m softdb.oanitem where regndt='07-Aug-2003' and regnno='00CHEN0
    023120' and qtndt='07-Aug-2003' and qtnno='00CHEN0023120') and
    regndt='07-Aug-2003' and regnno='00CHEN0023120' and qtndt='07-A
    ug-2003' and qtnno='00CHEN0023120'
    1,547 2 773.5 0.2 0.08 0.31 2526194774
    delete from softdb.oanlevy where oanno not in (select oanno fro
    m softdb.oanitem where regndt='07-Aug-2003' and regnno='00MUMB0
    023121' and qtndt='07-Aug-2003' and qtnno='00MUMB0023121') and
    regndt='07-Aug-2003' and regnno='00MUMB0023121' and qtndt='07-A
    ug-2003' and qtnno='00MUMB0023121'
    1,404 2 702.0 0.1 0.11 0.23 3517028935
    select softdb.oanaddr.*, softdb.oanaddr.ROWID from softdb.oanadd
    r where delflg='N' and commid is null
    1,298 2 649.0 0.1 0.09 0.27 2203325864
    delete from softdb.oanaddr where oanno not in (select oanno from
    softdb.oanitem where regndt='07-Aug-2003' and regnno='00MUMB00
    23121' and qtndt='07-Aug-2003' and qtnno='00MUMB0023121') and r
    egndt='07-Aug-2003' and regnno='00MUMB0023121' and qtndt='07-Au
    g-2003' and qtnno='00MUMB0023121'
    1,261 6 210.2 0.1 0.05 0.15 576637004
    delete from softdb.ordterms where commid is not null and regndt=
    '07-Aug-2003' and regnno='00CHEN0023120' and qtndt='07-Aug-2003'
    and qtnno='00CHEN0023120' and commid not in (select commid from
    softdb.commdeliitems where regndt='07-Aug-2003' and regnno='00C
    HEN0023120' and qtndt='07-Aug-2003' and qtnno='00CHEN0023120')
    1,244 6 207.3 0.1 0.06 0.15 563121091
    select softdb.ordterms.*, softdb.ordterms.ROWID from softdb.or
    dterms where delflg='N' and regndt ='07-Aug-2003' and regnno='
    SQL ordered by Executions for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Executions Threshold: 100
    CPU per Elap per
    Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
    144,980 144,980 1.0 0.00 0.00 2091761008
    select condition from cdef$ where rowid=:1
    23,545 0 0.0 0.00 0.00 1981921526
    update object_usage set flags=flags+1 where obj#=:1 and bitand(f
    lags, 1)=0
    16,526 16,519 1.0 0.00 0.00 3016965513
    update sys.col_usage$ set equality_preds = equality_preds
    + decode(bitand(:flag,1),0,0,1), equijoin_preds = equijoi
    n_preds + decode(bitand(:flag,2),0,0,1), nonequijoin_preds
    = nonequijoin_preds + decode(bitand(:flag,4),0,0,1), range_pre
    ds = range_preds + decode(bitand(:flag,8),0,0,1),
    10,812 0 0.0 0.00 0.00 4031175624
    alter session set isolation_level = read committed
    8,449 13 0.0 0.00 0.00 2963598673
    select job, nvl2(last_date, 1, 0) from sys.job$ where (((:1 <= n
    ext_date) and (next_date < :2)) or ((last_date is null) and
    (next_date < :3))) and (field1 = :4 or (field1 = 0 and 'Y' = :5)
    ) and (this_date is null) order by next_date, job
    8,437 8,437 1.0 0.00 0.00 2964743345
    select count(*) from sys.job$ where (next_date > sysdate) and (n
    ext_date < (sysdate+5/86400))
    4,152 4,152 1.0 0.00 0.00 3879177167
    select :V00001 from dual
    2,703 45,951 17.0 0.00 0.00 1947239399
    Module: VPXDBA
    /* OracleOEM */ select value from v$parameter where name in ('d
    b_block_buffers','buffer_pool_keep','db_block_lru_latches','buff
    er_pool_recycle', 'log_buffer','cursor_space_for_time','open_cur
    sors','shared_pool_size', 'shared_pool_reserved_size','session_c
    ached_cursors','parallel_min_servers', 'parallel_max_servers','s
    2,533 628,184 248.0 0.00 0.00 71821313
    Module: VPXDBA
    /* OracleOEM */ select value from v$sysstat order by statistic#
    2,532 2,532 1.0 0.00 0.00 3077298272
    Module: VPXDBA
    /* OracleOEM */ select sum(decode(name,'free memory',bytes)), su
    m(bytes) from v$sgastat where pool='shared pool'
    2,504 2,504 1.0 0.00 0.00 1818901441
    Module: VPXDBA
    /* OracleOEM */ select sum(decode(status,'ACTIVE',1,0)),sum(deco
    de(status,'INACTIVE',1,0))from v$session
    2,492 62,998 25.3 0.01 0.01 2080871317
    Module: VPXDBA
    SQL ordered by Executions for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Executions Threshold: 100
    CPU per Elap per
    Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
    /* OracleOEM */ select event,time_waited,total_waits, total_tim
    eouts from v$system_event where event not in ('PX Idle Wait','p
    mon timer','smon timer','rdbms ipc message', 'parallel dequeue w
    ait', 'parallel query dequeue','virtual circuit', 'SQL*Net
    message from client','SQL*Net message to client', 'SQL*Ne
    2,389 37 0.0 0.00 0.00 4266807470
    Module: VPXDBA
    /* OracleOEM */ select event, count(*) from v$session_wait where
    wait_time = 0 and event not in ('PX Idle Wait','pmon timer','s
    mon timer','rdbms ipc message', 'parallel dequeue wait', 'parall
    el query dequeue','virtual circuit', 'SQL*Net message from clien
    t','SQL*Net message to client','SQL*Net more data to client', 'S
    2,196 2,196 1.0 0.00 0.00 1903595484
    Module: VPXDBA
    /* OracleOEM */ select sum(pins), sum(pinhits), sum(reloads) fro
    m v$librarycache
    2,196 24,493 11.2 0.00 0.00 2352784315
    Module: VPXDBA
    /* OracleOEM */ SELECT s.sid, s.serial#, s.fixed_table_sequence,
    s.status,NVL(s.username,bg.name), cpu.value tot_cpu, physio.va
    lue phys_reads,parse.value hard_parse, mem.value pga,logio.v
    alue log_reads FROM v$session s, v$bgprocess bg, (SELE
    CT sid,value FROM v$sesstat WHERE statistic# = :1) cpu, (SEL
    2,046 3,716 1.8 0.00 0.00 360204161
    SELECT BUCKET, ENDPTHASH, ENDPTVAL, UTL_RAW.CAST_TO_
    RAW(ENDPTVAL) ENDPTVAL_RAW FROM SYS.EXU8HSTU WHERE
    POBJID = :1 AND INTCOL = :2 ORDER BY BUCKET
    1,507 0 0.0 0.00 0.00 1930352736
    select softdb.oanitem.*, softdb.oanitem.ROWID from softdb.oanite
    m where delflg='N' and oandt='' and oanno=0 order by itemsrlno
    1,507 0 0.0 0.00 0.00 3801509667
    select softdb.oanudetails.*, softdb.oanudetails.ROWID from softd
    b.oanudetails where delflg='N' and oandt='' and oanno=0
    956 897 0.9 0.00 -0.00 2591785020
    select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$,
    spare1, spare2 from obj$ where owner#=:1 and name=:2 and namespa
    ce=:3 and(remoteowner=:4 or remoteowner is null and :4 is null)a
    nd(linkname=:5 or linkname is null and :5 is null)and(subname=:6
    or subname is null and :6 is null)
    939 1,479 1.6 0.00 0.00 1819073277
    select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_
    obj#, d_owner#, nvl(property,0),subname from dependency$,obj$ wh
    ere d_obj#=:1 and p_obj#=obj#(+) order by order#
    939 1,055 1.1 0.00 0.00 4049165760
    select order#,columns,types from access$ where d_obj#=:1
    SQL ordered by Executions for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Executions Threshold: 100
    CPU per Elap per
    Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
    807 45,999 57.0 0.00 0.00 2705315382
    select length(invcode), softdb.blocnmanager.ROWID from softdb.bl
    ocnmanager
    550 204 0.4 0.00 0.00 2197684639
    BEGIN SYS.DBMS_DESCRIBE.DESCRIBE_PROCEDURE(:object_name,:res1,:r
    es2,:overload,:position,:level,:argument,:datatype,:default,:in_
    out,:length,:precision,:scale,:radix,:spare); END;
    SQL ordered by Parse Calls for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Parse Calls Threshold: 1000
    % Total
    Parse Calls Executions Parses Hash Value
    144,980 144,980 39.95 2091761008
    select condition from cdef$ where rowid=:1
    23,545 23,545 6.49 1981921526
    update object_usage set flags=flags+1 where obj#=:1 and bitand(f
    lags, 1)=0
    10,812 10,812 2.98 4031175624
    alter session set isolation_level = read committed
    4,152 4,152 1.14 3879177167
    select :V00001 from dual
    2,379 4 0.66 1635934014
    insert into sys.col_usage$ values ( :objn, :coln, decode(bit
    and(:flag,1),0,0,1), decode(bitand(:flag,2),0,0,1), decode(b
    itand(:flag,4),0,0,1), decode(bitand(:flag,8),0,0,1), decode
    (bitand(:flag,16),0,0,1), decode(bitand(:flag,32),0,0,1), :t
    ime)
    2,336 16,526 0.64 3016965513
    update sys.col_usage$ set equality_preds = equality_preds
    + decode(bitand(:flag,1),0,0,1), equijoin_preds = equijoi
    n_preds + decode(bitand(:flag,2),0,0,1), nonequijoin_preds
    = nonequijoin_preds + decode(bitand(:flag,4),0,0,1), range_pre
    ds = range_preds + decode(bitand(:flag,8),0,0,1),
    1,655 0 0.46 3877138136
    SELECT softdb.logpslipitem.*, softdb.logpslipitem.ROWID FROM sof
    tdb.logpslipitem
    1,507 1,507 0.42 1930352736
    select softdb.oanitem.*, softdb.oanitem.ROWID from softdb.oanite
    m where delflg='N' and oandt='' and oanno=0 order by itemsrlno
    1,507 1,507 0.42 3801509667
    select softdb.oanudetails.*, softdb.oanudetails.ROWID from softd
    b.oanudetails where delflg='N' and oandt='' and oanno=0
    1,357 0 0.37 2921321908
    SELECT softdb.keytab.*, softdb.keytab.ROWID FROM softdb.keytab
    1,175 0 0.32 126022112
    SELECT softdb.logpslip.*, softdb.logpslip.ROWID FROM softdb.logp
    slip
    1,175 0 0.32 3554166107
    select * from softdb.logpslipitem
    1,175 0 0.32 3928397926
    select * from softdb.logpslip
    939 939 0.26 1819073277
    select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_
    SQL ordered by Parse Calls for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Parse Calls Threshold: 1000
    % Total
    Parse Calls Executions Parses Hash Value
    obj#, d_owner#, nvl(property,0),subname from dependency$,obj$ wh
    ere d_obj#=:1 and p_obj#=obj#(+) order by order#
    939 939 0.26 4049165760
    select order#,columns,types from access$ where d_obj#=:1
    807 807 0.22 2705315382
    select length(invcode), softdb.blocnmanager.ROWID from softdb.bl
    ocnmanager
    718 359 0.20 3882939652
    INSERT INTO "SOFTDB"."MULTIUSER" ("REGNNO","PROCESSNAME","USRNAM
    E","INSTLOCATION","MCNAME","IPADDR","REGNDT") VALUES (:V00001,:V
    00002,:V00003,:V00004,:V00005,:V00006,:V00007)
    650 325 0.18 3046100812
    UPDATE "SOFTDB"."GENCOMMID" SET "GNO"=:V00001,"GDT"=:V00002 WHER
    E "GNO"=:V00003 AND "GDT"=:V00004 AND "ROWID"=:V00005
    550 550 0.15 2197684639
    BEGIN SYS.DBMS_DESCRIBE.DESCRIBE_PROCEDURE(:object_name,:res1,:r
    es2,:overload,:position,:level,:argument,:datatype,:default,:in_
    out,:length,:precision,:scale,:radix,:spare); END;
    510 510 0.14 3187596784
    select rownum as srlno,softdb.keytab.itemdesc as item,1 as sets,
    qty from (select itemsrlno,itemdesc,1 as qty,oanno,oandt from s
    oftdb.oanups where delflg='N' and oandt='' and oanno=0 union se
    lect itemsrlno,itemdesc,deliqty/delisets as qty, oanno,oandt fr
    om softdb.oanbat where delflg='N' and oandt='' and oanno=0 and i
    443 443 0.12 1781254858
    DELETE multiuser where floor((((((sysdate-recentrytime)*24*60*60
    )/3600)*3600)/60)*60) >='180'
    443 443 0.12 3292238282
    Select softdb.multiuser.*, softdb.multiuser.ROWID from softdb.mu
    ltiuser
    422 422 0.12 1919856422
    select invcode, softdb.blocnmanager.ROWID from softdb.blocnmanag
    er
    390 195 0.11 2471695061
    UPDATE "SOFTDB"."CUST_MAST" SET "CUST_LST_NO"=:V00001,"CUST_CST_
    NO"=:V00002 WHERE "CUST_LST_NO" IS NULL AND "CUST_CST_NO" IS NUL
    L AND "ROWID"=:V00003
    387 387 0.11 620898497
    select * from (select null table_catalog, idx.table_owner table_
    schema, idx.table_name table_name, null index_catalog, idx.owner
    index_schema, idx.index_name index_name, null primary_key, deco
    de(idx.uniqueness, 'UNIQUE', 65535, 0) unique_, decode(idx.index
    type, 'CLUSTER', 65535, 0) clustered, null type, null fillfact
    SQL ordered by Parse Calls for DB: ST011 Instance: st011 Snaps: 41 -62
    -> End Parse Calls Threshold: 1000
    % Total
    Parse Calls Executions Parses Hash Value
    387 387 0.11 1647834759
    select * from (select null table_catalog, ac.owner table_schema,
    ac.table_name table_name, acc.column_name column_name, null col
    umn_guid, null column_propid, acc.position ordinal, ac.constrain
    t_name pk_name from all_constraints ac, all_cons_columns acc whe
    re ac.owner=acc.owner and ac.constraint_type='P' and ac.constrai
    Instance Activity Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    Statistic Total per Second per Trans
    CPU used by this session 102,453 1.6 4.8
    CPU used when call started 102,366 1.6 4.8
    CR blocks created 30 0.0 0.0
    DBWR buffers scanned 1,184 0.0 0.1
    DBWR checkpoint buffers written 7,748 0.1 0.4
    DBWR checkpoints 9 0.0 0.0
    DBWR free buffers found 1,184 0.0 0.1
    DBWR lru scans 1 0.0 0.0
    DBWR make free requests 1 0.0 0.0
    DBWR summed scan depth 1,184 0.0 0.1
    DBWR transaction table writes 295 0.0 0.0
    DBWR undo block writes 1,681 0.0 0.1
    SQL*Net roundtrips to/from client 1,979,199 29.9 92.3
    active txn count during cleanout 682 0.0 0.0
    background checkpoints completed 1 0.0 0.0
    background checkpoints started 1 0.0 0.0
    background timeouts 74,152 1.1 3.5
    buffer is not pinned count 45,599,192 689.3 2,126.9
    buffer is pinned count 55,241,935 835.1 2,576.7
    bytes received via SQL*Net from c 140,543,392 2,124.5 6,555.5
    bytes sent via SQL*Net to client 16,971,012,142 256,538.0 791,595.3
    calls to get snapshot scn: kcmgss 706,463 10.7 33.0
    calls to kcmgas 20,519 0.3 1.0
    calls to kcmgcs 591 0.0 0.0
    change write time 175 0.0 0.0
    cleanout - number of ktugct calls 866 0.0 0.0
    cleanouts and rollbacks - consist 16 0.0 0.0
    cleanouts only - consistent read 123 0.0 0.0
    cluster key scan block gets 266,789 4.0 12.4
    cluster key scans 104,922 1.6 4.9
    commit cleanout failures: callbac 5 0.0 0.0
    commit cleanouts 28,117 0.4 1.3
    commit cleanouts successfully com 28,112 0.4 1.3
    commit txn count during cleanout 458 0.0 0.0
    consistent changes 295 0.0 0.0
    consistent gets 57,426,682 868.1 2,678.6
    consistent gets - examination 2,489,520 37.6 116.1
    cursor authentications 27,054 0.4 1.3
    data blocks consistent reads - un 283 0.0 0.0
    db block changes 139,574 2.1 6.5
    db block gets 130,344 2.0 6.1
    deferred (CURRENT) block cleanout 17,394 0.3 0.8
    dirty buffers inspected 3 0.0 0.0
    enqueue conversions 583 0.0 0.0
    enqueue releases 112,816 1.7 5.3
    enqueue requests 112,817 1.7 5.3
    enqueue waits 9 0.0 0.0
    execute count 386,246 5.8 18.0
    free buffer inspected 3 0.0 0.0
    free buffer requested 578,165 8.7 27.0
    hot buffers moved to head of LRU 3,435 0.1 0.2
    immediate (CR) block cleanout app 139 0.0 0.0
    immediate (CURRENT) block cleanou 3,076 0.1 0.1
    index fast full scans (full) 602 0.0 0.0
    index fetch by key 1,311,085 19.8 61.2
    index scans kdiixs1 26,311,841 397.7 1,227.3
    Instance Activity Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    Statistic Total per Second per Trans
    leaf node 90-10 splits 28 0.0 0.0
    leaf node splits 272 0.0 0.0
    logons cumulative 181 0.0 0.0
    messages received 12,637 0.2 0.6
    messages sent 12,637 0.2 0.6
    no buffer to keep pinned count 0 0.0 0.0
    no work - consistent read gets 28,721,411 434.2 1,339.7
    opened cursors cumulative 327,186 5.0 15.3
    parse count (failures) 6,872 0.1 0.3
    parse count (hard) 59,067 0.9 2.8
    parse count (total) 362,907 5.5 16.9
    parse time cpu 13,489 0.2 0.6
    parse time elapsed 13,800 0.2 0.6
    physical reads 995,675 15.1 46.4
    physical reads direct 426,595 6.5 19.9
    physical writes 266,178 4.0 12.4
    physical writes direct 258,427 3.9 12.1
    physical writes non checkpoint 261,972 4.0 12.2
    prefetched blocks 473,387 7.2 22.1
    process last non-idle time 124,048,980,297 1,875,154.6 5,786,136.5
    recovery blocks read 0 0.0 0.0
    recursive calls 1,469,320 22.2 68.5
    recursive cpu usage 5,757 0.1 0.3
    redo blocks written 66,895 1.0 3.1
    redo entries 73,459 1.1 3.4
    redo size 29,472,392 445.5 1,374.7
    redo synch time 8,922 0.1 0.4
    redo synch writes 10,687 0.2 0.5
    redo wastage 3,617,376 54.7 168.7
    redo write time 9,727 0.2 0.5
    redo writer latching time 3 0.0 0.0
    redo writes 12,337 0.2 0.6
    rollback changes - undo records a 22 0.0 0.0
    rollbacks only - consistent read 19 0.0 0.0
    rows fetched via callback 1,127,456 17.0 52.6
    session connect time 124,048,980,297 1,875,154.6 5,786,136.5
    session logical reads 57,557,026 870.1 2,684.7
    session pga memory 428,308 6.5 20.0
    session pga memory max 63,116 1.0 2.9
    session uga memory 4,296,889,276 64,952.8 200,424.0
    session uga memory max 123,298,368 1,863.8 5,751.1
    shared hash latch upgrades - no w 26,310,630 397.7 1,227.2
    sorts (disk) 367 0.0 0.0
    sorts (memory) 89,870 1.4 4.2
    sorts (rows) 13,381,553 202.3 624.2
    summed dirty queue length 3 0.0 0.0
    switch current to new buffer 6,910 0.1 0.3
    table fetch by rowid 32,481,075 491.0 1,515.1
    table fetch continued row 13,074 0.2 0.6
    table scan blocks gotten 8,213,616 124.2 383.1
    table scan rows gotten 303,670,060 4,590.4 14,164.4
    table scans (long tables) 2,799 0.0 0.1
    table scans (short tables) 76,890 1.2 3.6
    transaction rollbacks 11 0.0 0.0
    user calls 1,067,154 16.1 49.8
    user commits 10,678 0.2 0.5
    Instance Activity Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    Statistic Total per Second per Trans
    user rollbacks 10,761 0.2 0.5
    workarea executions - onepass 803 0.0 0.0
    workarea executions - optimal 126,987 1.9 5.9
    write clones created in foregroun 2 0.0 0.0
    Tablespace IO Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    ->ordered by IOs (Reads + Writes) desc
    Tablespace
    Av Av Av Av Buffer Av Buf
    Reads Reads/s Rd(ms) Blks/Rd Writes Writes/s Waits Wt(ms)
    TEMP
    397,017 6 0.8 1.1 199,016 3 0 0.0
    SOFTDB
    91,699 1 1.0 6.1 1,823 0 0 0.0
    USERS
    450 0 5.3 1.0 2,524 0 0 0.0
    SYSTEM
    2,438 0 2.9 1.3 239 0 0 0.0
    INDX
    1,095 0 4.4 1.5 1,153 0 0 0.0
    UNDOTBS1
    3 0 13.3 1.0 2,017 0 8 0.0
    XDB
    74 0 4.9 1.1 1 0 0 0.0
    DRSYS
    3 0 6.7 1.0 1 0 0 0.0
    TOOLS
    3 0 6.7 1.0 1 0 0 0.0
    File IO Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    ->ordered by Tablespace, File
    Tablespace Filename
    Av Av Av Av Buffer Av Buf
    Reads Reads/s Rd(ms) Blks/Rd Writes Writes/s Waits Wt(ms)
    DRSYS E:\ORACLE\ORADATA\ST011\DRSYS01.DBF
    3 0 6.7 1.0 1 0 0
    INDX E:\ORACLE\ORADATA\ST011\INDX01.DBF
    1,095 0 4.4 1.5 1,153 0 0
    SOFTDB E:\ORACLE\ORADATA\ST011\SOFTDB01.DBF
    91,699 1 1.0 6.1 1,823 0 0
    SYSTEM E:\ORACLE\ORADATA\ST011\SYSTEM01.DBF
    2,438 0 2.9 1.3 239 0 0
    TEMP E:\ORACLE\ORADATA\ST011\TEMP01.DBF
    397,017 6 0.8 1.1 199,016 3 0
    TOOLS E:\ORACLE\ORADATA\ST011\TOOLS01.DBF
    3 0 6.7 1.0 1 0 0
    UNDOTBS1 E:\ORACLE\ORADATA\ST011\UNDOTBS01.DBF
    3 0 13.3 1.0 2,017 0 8 0.0
    USERS E:\ORACLE\ORADATA\ST011\USERS01.DBF
    450 0 5.3 1.0 2,524 0 0
    XDB E:\ORACLE\ORADATA\ST011\XDB01.DBF
    74 0 4.9 1.1 1 0 0
    Buffer Pool Statistics for DB: ST011 Instance: st011 Snaps: 41 -62
    -> Standard block size Pools D: default, K: keep, R: recycle
    -> Default Pools for other block sizes: 2k, 4k, 8k, 16k, 32k
    Free Write Buffer
    Number of Cache Buffer Physical Physical Buffer Complete Busy
    P Buffers Hit % Gets Reads Writes Waits Waits Waits
    D 17,017 99.5 110,003,087 569,129 7,751 0 0 8
    Instance Recovery Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    -> B: Begin snapshot, E: End snapshot
    Targt Estd Log File Log Ckpt Log Ckpt
    MTTR MTTR Recovery Actual Target Size Timeout Interval
    (s) (s) Estd IOs Redo Blks Redo Blks Redo Blks Redo Blks Redo Blks
    B 34 14 193 771 341 184320 341
    E 34 14 141 727 20 184320 20
    Buffer Pool Advisory for DB: ST011 Instance: st011 End Snap: 62
    -> Only rows with estimated physical reads >0 are displayed
    -> ordered by Block Size, Buffers For Estimate
    Size for Size Buffers for Est Physical Estimated
    P Estimate (M) Factr Estimate Read Factor Physical Reads
    D 16 .1 2,002 152.10 87,449,432
    D 32 .2 4,004 87.09 50,071,540
    D 48 .4 6,006 55.08 31,668,480
    D 64 .5 8,008 36.93 21,232,658
    D 80 .6 10,010 16.08 9,246,410
    D 96 .7 12,012 6.32 3,635,060
    D 112 .8 14,014 2.48 1,423,893
    D 128 .9 16,016 1.09 627,130
    D 136 1.0 17,017 1.00 574,935
    D 144 1.1 18,018 0.96 552,001
    D 160 1.2 20,020 0.91 525,903
    D 176 1.3 22,022 0.90 518,390
    D 192 1.4 24,024 0.90 518,390
    D 208 1.5 26,026 0.90 518,390
    D 224 1.6 28,028 0.90 518,390
    D 240 1.8 30,030 0.90 518,390
    D 256 1.9 32,032 0.90 518,390
    D 272 2.0 34,034 0.90 518,390
    D 288 2.1 36,036 0.90 518,390
    D 304 2.2 38,038 0.90 518,390
    D 320 2.4 40,040 0.90 518,390
    Buffer wait Statistics for DB: ST011 Instance: st011 Snaps: 41 -62
    -> ordered by wait time desc, waits desc
    Tot Wait Avg
    Class Waits Time (s) Time (ms)
    undo header 9 0 0
    PGA Aggr Target Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    -> B: Begin snap E: End snap (rows dentified with B or E contain data
    which is absolute i.e. not diffed over the interval)
    -> PGA cache hit % - percentage of W/A (WorkArea) data processed only in-memory
    -> Auto PGA Target - actual workarea memory target
    -> W/A PGA Used - amount of memory used for all Workareas (manual + auto)
    -> %PGA W/A Mem - percentage of PGA memory allocated to workareas
    -> %Auto W/A Mem - percentage of workarea memory controlled by Auto Mem Mgmt
    -> %Man W/A Mem - percentage of workarea memory under manual control
    PGA Cache Hit % W/A MB Processed Extra W/A MB Read/Written
    72.5 6,444 2,443
    %PGA %Auto %Man
    PGA Aggr Auto PGA PGA Mem W/A PGA W/A W/A W/A Global Mem
    Target(M) Target(M) Alloc(M) Used(M) Mem Mem Mem Bound(K)
    B 104 80 17.8 0.0 .0 .0 .0 5,324
    E 104 81 18.5 0.0 .0 .0 .0 5,324
    PGA Aggr Target Histogram for DB: ST011 Instance: st011 Snaps: 41 -62
    -> Optimal Executions are purely in-memory operations
    Low High
    Optimal Optimal Total Execs Optimal Execs 1-Pass Execs M-Pass Execs
    8K 16K 119,925 119,925 0 0
    16K 32K 1,796 1,796 0 0
    32K 64K 147 147 0 0
    64K 128K 1,167 1,167 0 0
    128K 256K 562 562 0 0
    256K 512K 647 615 32 0
    512K 1024K 2,770 2,412 358 0
    1M 2M 588 256 332 0
    2M 4M 70 10 60 0
    4M 8M 36 20 16 0
    16M 32M 4 0 4 0
    1G 2G 1 0 1 0
    PGA Memory Advisory for DB: ST011 Instance: st011 End Snap: 62
    -> When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value
    where Estd PGA Overalloc Count is 0
    Estd Extra Estd PGA Estd PGA
    PGA Target Size W/A MB W/A MB Read/ Cache Overalloc
    Est (MB) Factr Processed Written to Disk Hit % Count
    13 0.1 1,552.2 362.1 81.0 27
    26 0.3 1,552.2 85.5 95.0 0
    52 0.5 1,552.2 74.5 95.0 0
    78 0.8 1,552.2 74.5 95.0 0
    104 1.0 1,552.2 55.1 97.0 0
    125 1.2 1,552.2 0.0 100.0 0
    146 1.4 1,552.2 0.0 100.0 0
    166 1.6 1,552.2 0.0 100.0 0
    187 1.8 1,552.2 0.0 100.0 0
    208 2.0 1,552.2 0.0 100.0 0
    312 3.0 1,552.2 0.0 100.0 0
    416 4.0 1,552.2 0.0 100.0 0
    624 6.0 1,552.2 0.0 100.0 0
    832 8.0 1,552.2 0.0 100.0 0
    Enqueue activity for DB: ST011 Instance: st011 Snaps: 41 -62
    -> Enqueue stats gathered prior to 9i should not be compared with 9i data
    -> ordered by Wait Time desc, Waits desc
    Avg Wt Wait
    Eq Requests Succ Gets Failed Gets Waits Time (ms) Time (s)
    TC 40 40 0 8 254.13 2
    PE 184 184 0 1 47.00 0
    Rollback Segment Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    ->A high value for "Pct Waits" suggests more rollback segments may be required
    ->RBS stats may not be accurate between begin and end snaps when using Auto Undo
    managment, as RBS may be dynamically created and dropped as needed
    Trans Table Pct Undo Bytes
    RBS No Gets Waits Written Wraps Shrinks Extends
    0 246.0 0.00 0 0 0 0
    1 2,947.0 0.00 1,268,846 4 1 1
    2 3,520.0 0.00 1,003,166 18 3 6
    3 3,511.0 0.00 973,498 18 1 3
    4 2,662.0 0.00 1,010,600 4 0 1
    5 3,941.0 0.03 1,042,464 20 3 8
    6 3,474.0 0.00 1,106,576 21 1 6
    7 2,546.0 0.00 756,036 15 3 4
    8 3,943.0 0.00 1,112,166 22 3 11
    9 3,368.0 0.00 832,596 14 2 4
    10 3,039.0 0.20 971,780 20 3 14
    Rollback Segment Storage for DB: ST011 Instance: st011 Snaps: 41 -62
    ->Optimal Size should be larger than Avg Active
    RBS No Segment Size Avg Active Optimal Size Maximum Size
    0 385,024 0 385,024
    1 1,171,456 191,840 2,220,032
    2 385,024 78,348 516,096
    3 450,560 112,391 450,560
    4 2,220,032 101,425 2,220,032
    5 778,240 134,380 843,776
    6 647,168 78,286 647,168
    7 319,488 86,191 581,632
    8 516,096 90,060 778,240
    9 516,096 49,626 516,096
    10 450,560 132,513 647,168
    Undo Segment Summary for DB: ST011 Instance: st011 Snaps: 41 -62
    -> Undo segment block stats:
    -> uS - unexpired Stolen, uR - unexpired Released, uU - unexpired reUsed
    -> eS - expired Stolen, eR - expired Released, eU - expired reUsed
    Undo Undo Num Max Qry Max Tx Snapshot Out of uS/uR/uU/
    TS# Blocks Trans Len (s) Concurcy Too Old Space eS/eR/eU
    1 1,555 551,825 1,575 2 0 0 0/0/15/0/0/0
    Undo Segment Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    -> ordered by Time desc
    Undo Num Max Qry Max Tx Snap Out of uS/uR/uU/
    End Time Blocks Trans Len (s) Concy Too Old Space eS/eR/eU
    08-Aug 03:53 0 0 0 0 0 0 0/0/0/0/0/0
    08-Aug 03:03 31 13,744 0 1 0 0 0/0/0/0/0/0
    08-Aug 02:53 0 0 0 0 0 0 0/0/0/0/0/0
    08-Aug 02:03 31 13,717 0 1 0 0 0/0/0/0/0/0
    08-Aug 01:53 0 0 0 0 0 0 0/0/0/0/0/0
    08-Aug 01:03 29 13,690 1 1 0 0 0/0/0/0/0/0
    08-Aug 00:53 0 0 0 0 0 0 0/0/0/0/0/0
    08-Aug 00:03 41 13,665 1 1 0 0 0/0/0/0/0/0
    07-Aug 23:53 0 0 0 0 0 0 0/0/0/0/0/0
    07-Aug 23:03 25 13,634 1 2 0 0 0/0/0/0/0/0
    07-Aug 22:53 0 0 0 0 0 0 0/0/0/0/0/0
    07-Aug 22:03 29 13,611 0 2 0 0 0/0/0/0/0/0
    07-Aug 21:53 0 0 0 0 0 0 0/0/0/0/0/0
    07-Aug 21:43 1 13,595 0 1 0 0 0/0/8/0/0/0
    07-Aug 21:33 1 13,591 0 1 0 0 0/0/0/0/0/0
    07-Aug 21:23 7 13,544 9 1 0 0 0/0/0/0/0/0
    07-Aug 21:13 1 13,448 12 1 0 0 0/0/0/0/0/0
    07-Aug 21:03 35 13,348 1 1 0 0 0/0/0/0/0/0
    07-Aug 20:53 7 13,212 9 1 0 0 0/0/0/0/0/0
    07-Aug 20:43 9 12,967 13 1 0 0 0/0/0/0/0/0
    07-Aug 20:33 4 12,785 3 1 0 0 0/0/0/0/0/0
    07-Aug 20:23 4 12,717 3 1 0 0 0/0/0/0/0/0
    07-Aug 20:13 7 12,607 9 1 0 0 0/0/0/0/0/0
    07-Aug 20:03 49 12,472 8 2 0 0 0/0/0/0/0/0
    07-Aug 19:53 0 0 0 0 0 0 0/0/0/0/0/0
    07-Aug 19:43 10 12,425 2 1 0 0 0/0/0/0/0/0
    07-Aug 19:33 14 12,263 30 1 0 0 0/0/0/0/0/0
    07-Aug 19:23 25 12,046 4 1 0 0 0/0/0/0/0/0
    07-Aug 19:13 52 11,686 2 1 0 0 0/0/0/0/0/0
    07-Aug 19:03 71 11,077 7 1 0 0 0/0/0/0/0/0
    07-Aug 18:53 41 10,558 4 1 0 0 0/0/0/0/0/0
    07-Aug 18:43 17 9,996 12 1 0 0 0/0/0/0/0/0
    07-Aug 18:33 6 9,744 30 1 0 0 0/0/0/0/0/0
    07-Aug 18:23 9 9,548 2 1 0 0 0/0/0/0/0/0
    Latch Activity for DB: ST011 Instance: st011 Snaps: 41 -62
    ->"Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
    willing-to-wait latch get requests
    ->"NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
    ->"Pct Misses" for both should be very close to 0.0
    Pct Avg Wait Pct
    Get Get Slps Time NoWait NoWait
    Latch Requests Miss /Miss (s) Requests Miss
    Consistent RBA 12,338 0.0 0 0
    FAL request queue 2 0.0 0 0
    FAL subheap alocation 0 0 2 0.0
    FIB s.o chain latch 72 0.0 0 0
    FOB s.o list latch 388 0.0 0 0
    JOX SGA heap latch 3,415 0.0 0 3,013 0.0
    NLS data objects 3 0.0 0 0
    QMT 1 0.0 0 0
    SQL memory manager latch 21 0.0 0 21,360 0.0
    SQL memory manager worka 1,455,705 0.0 0 0
    Token Manager 0 0 2 0.0
    active checkpoint queue 22,780 0.0 0 2 0.0
    alert log latch 4 0.0 0 2 0.0
    archive control 2,189 0.0 0 0
    archive process latch 1,299 0.2 0.0 0 0
    begin backup scn array 8 0.0 0 0
    cache buffer handles 339,925 0.0 0 0
    cache buffers chains 113,609,670 0.0 0.0 0 1,095,458 0.0
    cache buffers lru chain 2,057,063 0.0 0 13,776 0.0
    channel handle pool latc 194 0.0 0 0
    channel operations paren 43,420 0.0 0 0
    checkpoint queue latch 1,094,874 0.0 0.0 0 7,196 0.0
    child cursor hash table 543,267 0.0 0 0
    dml lock allocation 99,677 0.0 0 0
    dummy allocation 362 2.8 0.0 0 0
    enqueue hash chains 226,227 0.0 0 0
    enqueues 235,237 0.0 0.0 0 0
    event group latch 95 0.0 0 0
    file number translation 699,304 0.0 0.0 0 0
    hash table column usage 2,980 0.0 0 779,274 0.0
    hash table modification 5 0.0 0 2 0.0
    job workq parent latch 0 0 26 7.7
    job_queue_processes para 745 0.0 0 2 0.0
    kmcptab latch 1,788 0.0 0 0
    kmcpvec latch 0 0 1,788 0.0
    ksfv messages 0 0 4 0.0
    ktm global data 260 0.0 0 0
    lgwr LWN SCN 29,530 0.0 0 0
    library cache 7,579,771 0.0 0.0 0 112,898 0.1
    library cache load lock 5,302 0.0 0 0
    library cache pin 3,098,174 0.0 0.0 0 0
    library cache pin alloca 2,124,257 0.0 0.0 0 0
    list of block allocation 321 0.0 0 0
    loader state object free 1,186 0.0 0 0
    longop free list parent 9 0.0 0 9 0.0
    message pool operations 9 0.0 0 0
    messages 209,721 0.2 0.0 0 0
    mostly latch-free SCN 29,532 0.0 0.0 0 0
    multiblock read objects 181,050 0.0 0 2 0.0
    name-service namespace o 0 0 2 0.0
    Latch Activity for DB: ST011 Instance: st011 Snaps: 41 -62
    ->"Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
    willing-to-wait latch get requests
    ->"NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
    ->"Pct Misses" for both should be very close to 0.0
    Pct Avg Wait Pct
    Get Get Slps Time NoWait NoWait
    Latch Requests Miss /Miss (s) Requests Miss
    ncodef allocation latch 1,065 0.0 0 0
    object stats modificatio 357 0.0 0 2 0.0
    post/wait queue 24,713 0.0 0 10,698 0.0
    process allocation 95 0.0 0 95 0.0
    process group creation 189 0.0 0 0
    qm_init_sga 1 0.0 0 0
    redo allocation 115,339 0.0 0.0 0 0
    redo copy 0 0 73,511 0.1
    redo writing 92,285 0.0 0 0
    resumable state object 351 0.0 0 0
    row cache enqueue latch 3,995,948 0.0 0.0 0 0
    row cache objects 4,004,202 0.0 0 696 0.0
    sequence cache 430 0.0 0 0
    session allocation 292,885 0.0 0.0 0 0
    session idle bit 2,269,446 0.0 0.0 0 0
    session switching 1,065 0.0 0 0
    session timer 22,218 0.0 0 0
    shared java pool 860 0.0 0 0
    shared pool 4,913,350 0.0 0.0 0 0
    sim partition latch 0 0 110 0.0
    simulator hash latch 4,433,428 0.0 0 0
    simulator lru latch 43,829 0.0 0 33,464 0.0
    sort extent pool 6,608 0.0 0 0
    temp lob duration state 2 0.0 0 0
    trace latch 13 0.0 0 0
    transaction allocation 931,196 0.0 0 0
    transaction branch alloc 1,065 0.0 0 0
    undo global data 57,750 0.0 0.0 0 0
    user lock 551 0.0 0 0
    vecio buf des 0 0 2 0.0
    virtual circuit buffers 10,648,289 0.2 0.0 0 0
    virtual circuit queues 5,140,393 0.0 0.0 0 0
    virtual circuits 1,824,349 0.0 0.0 0 0
    Latch Sleep breakdown for DB: ST011 Instance: st011 Snaps: 41 -62
    -> ordered by misses desc
    Get Spin &
    Latch Name Requests Misses Sleeps Sleeps 1->4
    virtual circuit buffers 10,648,289 19,024 3 19021/3/0/0/
    0
    shared pool 4,913,350 181 3 178/3/0/0/0
    cache buffers chains 113,609,670 63 1 0/0/0/0/0
    Latch Miss Sources for DB: ST011 Instance: st011 Snaps: 41 -62
    -> only latches with sleeps are shown
    -> ordered by name, sleeps desc
    NoWait Waiter
    Latch Name Where Misses Sleeps Sleeps
    cache buffers chains kcbgtcr: kslbegin excl 0 1 0
    shared pool kghalo 0 3 3
    virtual circuits kmcfms 0 1 1
    virtual circuits kmcgms: if not shared serv 0 1 0
    virtual circuits kmcmbf 0 1 1
    Dictionary Cache Stats for DB: ST011 Instance: st011 Snaps: 41 -62
    ->"Pct Misses" should be very low (< 2% in most cases)
    ->"Cache Usage" is the number of cache entries being used
    ->"Pct SGA" is the ratio of usage to allocated size for that cache
    Get Pct Scan Pct Mod Final
    Cache Requests Miss Reqs Miss Reqs Usage
    dc_files 3,248 0.2 0 0 8
    dc_global_oids 12,826 1.0 0 0 135
    dc_histogram_defs 1,214,659 0.1 0 0 2,451
    dc_object_ids 325,383 0.2 0 0 793
    dc_objects 72,357 1.9 0 2 1,504
    dc_profiles 125 0.0 0 0 1
    dc_qmc_cache_entries 1 100.0 0 0 1
    dc_rollback_segments 4,967 0.0 0 0 12
    dc_segments 168,507 0.4 0 0 760
    dc_sequences 8 37.5 0 8 2
    dc_tablespace_quotas 5 40.0 0 5 2
    dc_tablespaces 56,795 0.0 0 0 9
    dc_user_grants 1,393 1.1 0 0 22
    dc_usernames 70,029 0.0 0 0 15
    dc_users 71,699 0.0 0 0 25
    Library Cache Activity for DB: ST011 Instance: st011 Snaps: 41 -62
    ->"Pct Misses" should be very low
    Get Pct Pin Pct Invali-
    Namespace Requests Miss Requests Miss Reloads dations
    BODY 225 16.4 226 18.6 3 0
    CLUSTER 1,272 0.3 1,008 0.8 0 0
    JAVA DATA 2 100.0 9 44.4 0 0
    SQL AREA 368,746 14.6 1,388,192 8.3 5,561 1
    TABLE/PROCEDURE 114,852 1.3 375,552 0.9 494 0
    TRIGGER 1,082 1.0 1,082 1.4 4 0
    Shared Pool Advisory for DB: ST011 Instance: st011 End Snap: 62
    -> Note there is often a 1:Many correlation between a single logical object
    in the Library Cache, and the physical number of memory objects associated
    with it. Therefore comparing the number of Lib Cache objects (e.g. in
    v$librarycache), with the number of Lib Cache Memory Objects is invalid
    Estd
    Shared Pool SP Estd Estd Estd Lib LC Time
    Size for Size Lib Cache Lib Cache Cache Time Saved Estd Lib Cache
    Estim (M) Factr Size (M) Mem Obj Saved (s) Factr Mem Obj Hits
    96 .6 96 20,704 1,595 1.0 896,845
    120 .7 119 25,821 1,596 1.0 898,184
    144 .9 142 30,844 1,596 1.0 899,133
    168 1.0 165 35,862 1,597 1.0 900,259
    192 1.1 188 41,079 1,598 1.0 901,912
    216 1.3 215 47,275 1,598 1.0 902,360
    240 1.4 238 52,517 1,598 1.0 903,089
    264 1.6 261 58,043 1,598 1.0 903,310
    288 1.7 284 63,632 1,598 1.0 903,711
    312 1.9 307 69,230 1,598 1.0 904,029
    336 2.0 338 76,368 1,598 1.0 904,158
    SGA Memory Summary for DB: ST011 Instance: st011 Snaps: 41 -62
    SGA regions Size in Bytes
    Database Buffers 142,606,336
    Fixed Size 454,356
    Redo Buffers 667,648
    Variable Size 486,539,264
    sum 630,267,604
    SGA breakdown difference for DB: ST011 Instance: st011 Snaps: 41 -62
    Pool Name Begin value End value % Diff
    java free memory 33,554,432 30,031,872 -10.50
    large free memory 24,861,188 24,957,400 0.39
    large session heap 304,636 208,424 -31.58
    shared 1M buffer 2,098,176 2,098,176 0.00
    shared FileOpenBlock 695,504 695,504 0.00
    shared KGK heap 3,756 3,756 0.00
    shared KGLS heap 1,652,428 2,590,108 56.75
    shared KQR M PO 861,220 2,452,776 184.80
    shared KQR S PO 77,148 239,708 210.71
    shared KQR S SO 1,792 5,632 214.29
    shared KSXR pending messages que 841,036 841,036 0.00
    shared KSXR receive buffers 1,033,000 1,033,000 0.00
    shared MTTR advisory 25,400 29,636 16.68
    shared PL/SQL DIANA 625,620 951,760 52.13
    shared PL/SQL MPCODE 358,152 902,912 152.10
    shared PLS non-lib hp 2,068 2,068 0.00
    shared dictionary cache 1,610,880 1,610,880 0.00
    shared errors 25,144 46,460 84.78
    shared event statistics per sess 1,718,360 1,718,360 0.00
    shared fixed allocation callback 220 220 0.00
    shared free memory 157,840,156 13,956,720 -91.16
    shared joxs heap init 4,220 4,220 0.00
    shared kgl simulator 694,520 9,560,380 #######
    shared library cache 4,829,312 39,226,604 712.26
    shared message pool freequeue 834,752 834,752 0.00
    shared miscellaneous 5,094,676 7,076,492 38.90
    shared parameters 5,220 32,976 531.72
    shared sessions 410,720 410,720 0.00
    shared sim memory hea 93,176 93,176 0.00
    shared sql area 9,864,252 100,764,460 921.51
    shared table definiti 2,040 5,920 190.20
    shared trigger defini 1,888 2,208 16.95
    shared trigger inform 1,108 1,324 19.49
    shared trigger source 160 1,168 630.00
    buffer_cache 142,606,336 142,606,336 0.00
    fixed_sga 454,356 454,356 0.00
    log_buffer 656,384 656,384 0.00
    init.ora Parameters for DB: ST011 Instance: st011 Snaps: 41 -62
    End value
    Parameter Name Begin value (if different)
    background_dump_dest E:\oracle\admin\ST011\bdump
    compatible 9.2.0.1.0
    control_files E:\oracle\oradata\ST011\control01
    core_dump_dest E:\oracle\admin\ST011\cdump
    db_block_size 8192
    db_cache_size 142606336
    db_domain
    db_file_multiblock_read_count 16 8
    db_name ST011
    dispatchers (PROTOCOL=TCP)
    fast_start_mttr_target 300
    hash_join_enabled TRUE
    instance_name ST011
    java_pool_size 33554432
    job_queue_processes 0 5
    large_pool_size 25165824
    log_archive_dest_1 LOCATION=E:\oracle\oradata\ST011\
    log_archive_format %t_%s.dbf
    log_archive_start TRUE
    open_cursors 300
    pga_aggregate_target 109051904
    processes 150
    query_rewrite_enabled FALSE
    remote_login_passwordfile EXCLUSIVE
    sga_max_size 630267604
    shared_pool_size 176160768
    sort_area_size 524288
    star_transformation_enabled FALSE
    timed_statistics TRUE
    undo_management AUTO
    undo_retention 10800
    undo_tablespace UNDOTBS1
    user_dump_dest E:\oracle\admin\ST011\udump
    End of Report

    Frederic's right... you're summing up too many statspacks ..
    Can't see anything specific apart from the fact that Statspack itself is showing up in the top statements.
    First : define 'Slow' . What is your goal for 'Ok' ?
    Start thinking about sql_trace, tkprof and 10046 traces

  • Capture Web Cam image in APEX and Upload into the Database

    Overview
    By using a flash object, you should be able to interface with a usb web cam connected to the client machine. Their are a couple of open source ones that I know about, but the one I chose to go with is by Taboca Labs and is called CamCanvas. This is released under the MIT license, and it is at version 0.2, so not very mature - but in saying that it seems to do the trick. The next part is to upload a snapshot into the database - in this particular implementation, it is achieved by taking a snapshot, and putting that data into the canvas object. This is a new HTML5 element, so I am not certain what the IE support would be like. Once you have the image into the canvas, you can then use the provided function convertToDataURL() to convert the image into a Base64 encoded string, which you can then use to convert into to a BLOB. There is however one problem with the Base64 string - APEX has a limitation of 32k for and item value, so can't be submitted by normal means, and a workaround (AJAX) has to be implemented.
    Part 1. Capturing the Image from the Flash Object into the Canvas element
    Set up the Page
    Required Files
    Download the tarball of the webcam library from: https://github.com/taboca/CamCanvas-API-/tarball/master
    Upload the necessary components to your application. (The flash swf file can be got from one of the samples in the Samples folder. In the root of the tarball, there is actually a swf file, but this seems to be a different file than of what is in the samples - so I just stick with the one from the samples)
    Page Body
    Create a HTML region, and add the following:
        <div class="container">
           <object  id="iembedflash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240">
                <param name="movie" value="#APP_IMAGES#camcanvas.swf" />
                <param name="quality" value="high" />
              <param name="allowScriptAccess" value="always" />
                <embed  allowScriptAccess="always"  id="embedflash" src="#APP_IMAGES#camcanvas.swf" quality="high" width="320" height="240"
    type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" mayscript="true"  />
        </object>
        </div>
    <p><a href="javascript:captureToCanvas()">Capture</a></p>
    <canvas style="border:1px solid yellow"  id="canvas" width="320" height="240"></canvas>That will create the webcam container, and an empty canvas element for the captured image to go into.
    Also, have a hidden unprotected page item to store the Base64 code into - I called mine P2_IMAGE_BASE64
    HTML Header and Body Attribute
    Add the Page HTML Body Attribute as:
    onload="init(320,240)"
    JavaScript
    Add the following in the Function and Global Variable Declarations for the page (mostly taken out of the samples provided)
    //Camera relations functions
    var gCtx = null;
    var gCanvas = null;
    var imageData = null;
    var ii=0;
    var jj=0;
    var c=0;
    function init(ww,hh){
         gCanvas = document.getElementById("canvas");
         var w = ww;
         var h = hh;
         gCanvas.style.width = w + "px";
         gCanvas.style.height = h + "px";
         gCanvas.width = w;
         gCanvas.height = h;
         gCtx = gCanvas.getContext("2d");
         gCtx.clearRect(0, 0, w, h);
         imageData = gCtx.getImageData( 0,0,320,240);
    function passLine(stringPixels) {
         //a = (intVal >> 24) & 0xff;
         var coll = stringPixels.split("-");
         for(var i=0;i<320;i++) {
              var intVal = parseInt(coll);
              r = (intVal >> 16) & 0xff;
              g = (intVal >> 8) & 0xff;
              b = (intVal ) & 0xff;
              imageData.data[c+0]=r;
              imageData.data[c+1]=g;
              imageData.data[c+2]=b;
              imageData.data[c+3]=255;
              c+=4;
         if(c>=320*240*4) {
              c=0;
              gCtx.putImageData(imageData, 0,0);
    function captureToCanvas() {
         flash = document.getElementById("embedflash");
         flash.ccCapture();
         var canvEle = document.getElementById('canvas');
         $s('P2_IMAGE_BASE64', canvEle.toDataURL());//Assumes hidden item name is P2_IMAGE_BASE64
         clob_Submit();//this is a part of part (AJAX submit value to a collection) two
    }In the footer region of the page (which is just a loading image to show whilst the data is being submitted to the collection [hidden by default]) :<img src="#IMAGE_PREFIX#processing3.gif" id="AjaxLoading"
    style="display:none;position:absolute;left:45%;top:45%;padding:10px;border:2px solid black;background:#FFF;" />If you give it a quick test, you should be able to see the webcam feed and capture it into the canvas element by clicking the capture link, in between the two elements - it might through a JS error since the clob_Submit() function does not exist yet.
    *Part 2. Upload the image into the Database*
    As mentioned in the overview, the main limitation is that APEX can't submit values larger than 32k, which I hope the APEX development team will be fixing this limitation in a future release, the workaround isn't really good from a maintainability perspective.
    In the sample applications, there is one that demonstrates saving values to the database that are over 32k, which uses an AJAX technique: see http://www.oracle.com/technetwork/developer-tools/apex/application-express/packaged-apps-090453.html#LARGE.
    *Required Files*
    From the sample application, there is a script you need to upload, and reference in your page. So you can either install the sample application I linked to, or grab the script from the demonstration I have provided - its called apex_save_large.js.
    *Create a New Page*
    Create a page to Post the large value to (I created mine as 1000), and create the following process, with the condition that Request = SAVE. (All this is in the sample application for saving large values).declare
         l_code clob := empty_clob;
    begin
         dbms_lob.createtemporary( l_code, false, dbms_lob.SESSION );
         for i in 1..wwv_flow.g_f01.count loop
              dbms_lob.writeappend(l_code,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
         end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => wc_pkg_globals.g_base64_collection);
         apex_collection.add_member(p_collection_name => wc_pkg_globals.g_base64_collection,p_clob001 => l_code);
         htmldb_application.g_unrecoverable_error := TRUE;
    end;I also created a package for storing the collection name, which is referred to in the process, for the collection name:create or replace
    package
    wc_pkg_globals
    as
    g_base64_collection constant varchar2(40) := 'BASE64_IMAGE';
    end wc_pkg_globals;That is all that needs to be done for page 1000. You don't use this for anything else, *so go back to edit the camera page*.
    *Modify the Function and Global Variable Declarations* (to be able to submit large values.)
    The below again assumes the item that you want to submit has an item name of 'P2_IMAGE_BASE64', the condition of the process on the POST page is request = SAVE, and the post page is page 1000. This has been taken srtaight from the sample application for saving large values.//32K Limit workaround functions
    function clob_Submit(){
              $x_Show('AjaxLoading')
              $a_PostClob('P2_IMAGE_BASE64','SAVE','1000',clob_SubmitReturn);
    function clob_SubmitReturn(){
              if(p.readyState == 4){
                             $x_Hide('AjaxLoading');
                             $x('P2_IMAGE_BASE64').value = '';
              }else{return false;}
    function doSubmit(r){
    $x('P2_IMAGE_BASE64').value = ''
         flowSelectAll();
         document.wwv_flow.p_request.value = r;
         document.wwv_flow.submit();
    }Also, reference the script that the above code makes use of, in the page header<script type="text/javascript" src="#WORKSPACE_IMAGES#apex_save_large.js"></script>Assuming the script is located in workspace images, and not associated to a specific app. Other wise reference #APP_IMAGES#
    *Set up the table to store the images*CREATE TABLE "WC_SNAPSHOT"
    "WC_SNAPSHOT_ID" NUMBER NOT NULL ENABLE,
    "BINARY" BLOB,
    CONSTRAINT "WC_SNAPSHOT_PK" PRIMARY KEY ("WC_SNAPSHOT_ID")
    create sequence seq_wc_snapshot start with 1 increment by 1;
    CREATE OR REPLACE TRIGGER "BI_WC_SNAPSHOT" BEFORE
    INSERT ON WC_SNAPSHOT FOR EACH ROW BEGIN
    SELECT seq_wc_snapshot.nextval INTO :NEW.wc_snapshot_id FROM dual;
    END;
    Then finally, create a page process to save the image:declare
    v_image_input CLOB;
    v_image_output BLOB;
    v_buffer NUMBER := 64;
    v_start_index NUMBER := 1;
    v_raw_temp raw(64);
    begin
    --discard the bit of the string we dont need
    select substr(clob001, instr(clob001, ',')+1, length(clob001)) into v_image_input
    from apex_collections
    where collection_name = wc_pkg_globals.g_base64_collection;
    dbms_lob.createtemporary(v_image_output, true);
    for i in 1..ceil(dbms_lob.getlength(v_image_input)/v_buffer) loop
    v_raw_temp := utl_encode.base64_decode(utl_raw.cast_to_raw(dbms_lob.substr(v_image_input, v_buffer, v_start_index)));
    dbms_lob.writeappend(v_image_output, utl_raw.length(v_raw_temp),v_raw_temp);
    v_start_index := v_start_index + v_buffer;
    end loop;
    insert into WC_SNAPSHOT (binary) values (v_image_output); commit;
    end;Create a save button - add some sort of validation to make sure the hidden item has a value (i.e. image has been captured). Make the above conditional for request = button name so it only runs when you click Save (you probably want to disable this button until the data has been completely submitted to the collection - I haven't done this in the demonstration).
    Voila, you should have now be able to capture the image from a webcam. Take a look at the samples from the CamCanvas API for extra effects if you wanted to do something special.
    And of course, all the above assumed you want a resolution of 320 x 240 for the image.
    Disclaimer: At time of writing, this worked with a logitech something or rather webcam, and is completely untested on IE.
    Check out a demo: http://apex.oracle.com/pls/apex/f?p=trents_demos:webcam_i (my image is a bit blocky, but i think its just my webcam. I've seen others that are much more crisp using this) Also, just be sure to wait for the progress bar to dissappear before clicking Save.
    Feedback welcomed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hmm, maybe for some reason you aren't getting the base64 version of the saved image? Is the collection getting the full base64 string? Seems like its not getting any if its no data found.
    The javascript console is your friend.
    Also, in the example i used an extra page, from what one of the examples on apex packages apps had. But since then, I found this post by Carl: http://carlback.blogspot.com/2008/04/new-stuff-4-over-head-with-clob.html - I would use this technique for submitting the clob, over what I have done - as its less hacky. Just sayin.

  • HOW TO SEND A HEBREW EMAIL WITH ATTACHMENT USING DEMO_MAIL

    Hello All,
    This is Not a question , just attaching something I've implemented and might be interesting for few of us,
    This package I'm attaching allows to send Hebrew Language email + attaching files to it.
    This package is based on demo_mail package (combined here but you can search at google for more example information if needed).
    My Package is supplied as is , for any specific information regarding it , please contact me directly at : [email protected] or POST here.
    * Please also note , that this package allow file to be attach via URL (meaning you will have to define a link to this file, if you would like to implement a link to a local file , e.g : c:\temp\myfile , you will have to customize the package your self with database directories option etc ...)
    First I will attach an example of how to use it :
    ==================================
    begin
    demo_mail_heb.send_html_mail_attach(p_sender => '[email protected]',
    p_recipients => '[email protected]',
    p_subject => 'שלום וברכה עולם',
    p_data => '<hr><b>בוקר טוב</b><hr>',
    p_file_name => 'but_choose_file.gif',
    p_file_mime_type => 'application/pdf',
    p_file_URL => 'http://10.172.246.160:7777/i/but_choose_file.gif');
    end;
    Second Here is the Package (please note you will have to modify few settings in order to enable it , such as mail server address ..etc)
    ======================================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := 'mail.oracle.com';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'oracle.com';
    -- Customize the signature that will appear in the email's MIME header.
    -- Useful for versioning.
    MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
    --------------------- End Customizable Section ---------------------
    -- A unique string that demarcates boundaries of parts in a multi-part email
    -- The string should not appear inside the body of any part of the email.
    -- Customize this if needed or generate this randomly dynamically.
    BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
    FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
    LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
    utl_tcp.CRLF;
    -- A MIME type that denotes multi-part email (MIME) messages.
    MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
    BOUNDARY || '"';
    MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- A simple email API for sending email in plain text in a single call.
    -- The format of an email address is one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    -- The recipients is a list of email addresses separated by
    -- either a "," or a ";"
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2);
    -- Extended email API to send email in HTML or plain text with no size limit.
    -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
    -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
    -- email in non-ASCII or multi-byte character set. End the email with
    -- end_mail().
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
    -- Write email body in ASCII
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2);
    -- Write email body in non-ASCII (including multi-byte). The email body
    -- will be sent in the database character set.
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
    -- Write email body in binary
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
    -- APIs to send email with attachments. Attachments are sent by sending
    -- emails in "multipart/mixed" MIME format. Specify that MIME format when
    -- beginning an email with begin_mail().
    -- Send a single text attachment.
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE);
    -- Send a binary attachment. The attachment will be encoded in Base-64
    -- encoding format.
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE);
    -- Send an attachment with no size limit. First, begin the attachment
    -- with begin_attachment(). Then, call write_text repeatedly to send
    -- the attachment piece-by-piece. If the attachment is text-based but
    -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
    -- To send binary attachment, the binary content should first be
    -- encoded in Base-64 encoding format using the demo package for 8i,
    -- or the native one in 9i. End the attachment with end_attachment.
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL);
    -- End the attachment.
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
    -- Extended email API to send multiple emails in a session for better
    -- performance. First, begin an email session with begin_session.
    -- Then, begin each email with a session by calling begin_mail_in_session
    -- instead of begin_mail. End the email with end_mail_in_session instead
    -- of end_mail. End the email session by end_session.
    FUNCTION begin_session RETURN utl_smtp.connection;
    -- Begin an email in a session.
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
    --                     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL);
    -- End an email in a session.
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
    -- End an email session.
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    Utl_Http.set_proxy('www-proxy.us.oracle.com', 'oracle.com');
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- Return the next email address in the list of email addresses, separated
    -- by either a "," or a ";". The format of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
    addr VARCHAR2(256);
    i pls_integer;
    FUNCTION lookup_unquoted_char(str IN VARCHAR2,
                        chrs IN VARCHAR2) RETURN pls_integer AS
    c VARCHAR2(5);
    i pls_integer;
    len pls_integer;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := false;
    i := 1;
    len := length(str);
    WHILE (i <= len) LOOP
         c := substr(str, i, 1);
         IF (inside_quote) THEN
         IF (c = '"') THEN
         inside_quote := false;
         ELSIF (c = '\') THEN
         i := i + 1; -- Skip the quote character
         END IF;
         GOTO next_char;
         END IF;
         IF (c = '"') THEN
         inside_quote := true;
         GOTO next_char;
         END IF;
         IF (instr(chrs, c) >= 1) THEN
         RETURN i;
         END IF;
         <<next_char>>
         i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := ltrim(addr_list);
    i := lookup_unquoted_char(addr_list, ',;');
    IF (i >= 1) THEN
    addr := substr(addr_list, 1, i - 1);
    addr_list := substr(addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char(addr, '<');
    IF (i >= 1) THEN
    addr := substr(addr, i + 1);
    i := instr(addr, '>');
    IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Write a MIME header
    PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
                   name IN VARCHAR2,
                   value IN VARCHAR2) IS
    BEGIN
    -- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
    END;
    -- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
    PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) AS
    BEGIN
    IF (last) THEN
    utl_smtp.write_data(conn, LAST_BOUNDARY);
    ELSE
    utl_smtp.write_data(conn, FIRST_BOUNDARY);
    END IF;
    END;
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2) IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_mail(sender, recipients, subject);
    write_text(conn, message);
    end_mail(conn);
    END;
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_session;
    begin_mail_in_session(conn, sender, recipients, subject, mime_type,
    priority);
    RETURN conn;
    END;
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    END;
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW) IS
    BEGIN
    utl_smtp.write_raw_data(conn, message);
    END;
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    begin_attachment(conn, mime_type, inline, filename);
    write_text(conn, data);
    end_attachment(conn, last);
    END;
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    -- Split the Base64-encoded attachment into multiple lines
    i := 1;
    len := utl_raw.length(data);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
         utl_smtp.write_raw_data(conn,
         utl_encode.base64_encode(utl_raw.substr(data, i,
         MAX_BASE64_LINE_WIDTH)));
    ELSE
         utl_smtp.write_raw_data(conn,
         utl_encode.base64_encode(utl_raw.substr(data, i)));
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    end_attachment(conn, last);
    END;
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL) IS
    BEGIN
    write_boundary(conn);
    write_mime_header(conn, 'Content-Type', mime_type);
    IF (filename IS NOT NULL) THEN
    IF (inline) THEN
         write_mime_header(conn, 'Content-Disposition',
         'inline; filename="'||filename||'"');
    ELSE
         write_mime_header(conn, 'Content-Disposition',
         'attachment; filename="'||filename||'"');
    END IF;
    END IF;
    IF (transfer_enc IS NOT NULL) THEN
    write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END;
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (last) THEN
    write_boundary(conn, last);
    END IF;
    END;
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    end_mail_in_session(conn);
    end_session(conn);
    END;
    FUNCTION begin_session RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    -- open SMTP connection
    conn := utl_smtp.open_connection(smtp_host, smtp_port);
    utl_smtp.helo(conn, smtp_domain);
    RETURN conn;
    END;
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
                        mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   --     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
                        priority IN PLS_INTEGER DEFAULT NULL) IS
    my_recipients VARCHAR2(32767) := recipients;
    my_sender VARCHAR2(32767) := sender;
    BEGIN
    -- Specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, get_address(my_sender));
    -- Specify recipient(s) of the email.
    WHILE (my_recipients IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_address(my_recipients));
    END LOOP;
    -- Start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    write_mime_header(conn, 'From', sender);
    -- Set "To" MIME header
    write_mime_header(conn, 'To', recipients);
    -- Set "Subject" MIME header
    write_mime_header(conn, 'Subject', subject);
    -- Set "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- Set "X-Mailer" MIME header
    write_mime_header(conn, 'X-Mailer', MAILER_ID);
    -- Set priority:
    -- High Normal Low
    -- 1 2 3 4 5
    IF (priority IS NOT NULL) THEN
    write_mime_header(conn, 'X-Priority', priority);
    END IF;
    -- Send an empty line to denotes end of MIME headers and
    -- beginning of message body.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (mime_type LIKE 'multipart/mixed%') THEN
    write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
    END IF;
    END;
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.close_data(conn);
    END;
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.quit(conn);
    END;
    END;

    Hello All,
    Small modification - use this package and not the above
    HERE IS A WORKING CODE FOR SENDING HEBREW MESSAGES (INCLUDING SUBJECT IN UTF-8 APPEAR IN ALL EMAIL CLIENTS I HAVE CHECKED) + ATTACHMENTS
    Code attached below is supplied as is with no support. anyhow if help is needed , please contact me via [email protected]
    ============================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_HOST');
    smtp_port PLS_INTEGER := pst_ajax.getParameter('EMAIL_SMTP_PORT');
    smtp_domain VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_DOMAIN');
    -- Customize the signature that will appear in the email's MIME header.
    -- Useful for versioning.
    MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
    --------------------- End Customizable Section ---------------------
    -- A unique string that demarcates boundaries of parts in a multi-part email
    -- The string should not appear inside the body of any part of the email.
    -- Customize this if needed or generate this randomly dynamically.
    BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
    FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
    LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
    utl_tcp.CRLF;
    -- A MIME type that denotes multi-part email (MIME) messages.
    MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
    BOUNDARY || '"';
    MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- A simple email API for sending email in plain text in a single call.
    -- The format of an email address is one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    -- The recipients is a list of email addresses separated by
    -- either a "," or a ";"
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2);
    -- Extended email API to send email in HTML or plain text with no size limit.
    -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
    -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
    -- email in non-ASCII or multi-byte character set. End the email with
    -- end_mail().
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
    -- Write email body in ASCII
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2);
    -- Write email body in non-ASCII (including multi-byte). The email body
    -- will be sent in the database character set.
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
    -- Write email body in binary
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
    -- APIs to send email with attachments. Attachments are sent by sending
    -- emails in "multipart/mixed" MIME format. Specify that MIME format when
    -- beginning an email with begin_mail().
    -- Send a single text attachment.
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE);
    -- Send a binary attachment. The attachment will be encoded in Base-64
    -- encoding format.
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE);
    -- Send an attachment with no size limit. First, begin the attachment
    -- with begin_attachment(). Then, call write_text repeatedly to send
    -- the attachment piece-by-piece. If the attachment is text-based but
    -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
    -- To send binary attachment, the binary content should first be
    -- encoded in Base-64 encoding format using the demo package for 8i,
    -- or the native one in 9i. End the attachment with end_attachment.
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL);
    -- End the attachment.
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
    -- Extended email API to send multiple emails in a session for better
    -- performance. First, begin an email session with begin_session.
    -- Then, begin each email with a session by calling begin_mail_in_session
    -- instead of begin_mail. End the email with end_mail_in_session instead
    -- of end_mail. End the email session by end_session.
    FUNCTION begin_session RETURN utl_smtp.connection;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2;
    -- Begin an email in a session.
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
    --                     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL);
    -- End an email in a session.
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
    -- End an email session.
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => 'text/html; charset=UTF-8');--p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    v_mime_type varchar2(32767):=demo_mail.MULTIPART_MIME_TYPE;
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => v_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- Return the next email address in the list of email addresses, separated
    -- by either a "," or a ";". The format of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
    addr VARCHAR2(256);
    i pls_integer;
    FUNCTION lookup_unquoted_char(str IN VARCHAR2,
    chrs IN VARCHAR2) RETURN pls_integer AS
    c VARCHAR2(5);
    i pls_integer;
    len pls_integer;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := false;
    i := 1;
    len := length(str);
    WHILE (i <= len) LOOP
    c := substr(str, i, 1);
    IF (inside_quote) THEN
    IF (c = '"') THEN
    inside_quote := false;
    ELSIF (c = '\') THEN
    i := i + 1; -- Skip the quote character
    END IF;
    GOTO next_char;
    END IF;
    IF (c = '"') THEN
    inside_quote := true;
    GOTO next_char;
    END IF;
    IF (instr(chrs, c) >= 1) THEN
    RETURN i;
    END IF;
    <<next_char>>
    i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := ltrim(addr_list);
    i := lookup_unquoted_char(addr_list, ',;');
    IF (i >= 1) THEN
    addr := substr(addr_list, 1, i - 1);
    addr_list := substr(addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char(addr, '<');
    IF (i >= 1) THEN
    addr := substr(addr, i + 1);
    i := instr(addr, '>');
    IF (i >= 1) THEN
    addr := substr(addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Write a MIME header
    PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
    name IN VARCHAR2,
    value IN VARCHAR2) IS
    BEGIN
    -- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
    END;
    -- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
    PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
    last IN BOOLEAN DEFAULT FALSE) AS
    BEGIN
    IF (last) THEN
    utl_smtp.write_data(conn, LAST_BOUNDARY);
    ELSE
    utl_smtp.write_data(conn, FIRST_BOUNDARY);
    END IF;
    END;
    PROCEDURE mail(sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    message IN VARCHAR2) IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_mail(sender, recipients, subject);
    write_text(conn, message);
    end_mail(conn);
    END;
    FUNCTION begin_mail(sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    priority IN PLS_INTEGER DEFAULT NULL)
    RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_session;
    begin_mail_in_session(conn, sender, recipients, subject, mime_type,
    priority);
    RETURN conn;
    END;
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
    message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    -- utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
    message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
    message IN RAW) IS
    BEGIN
    utl_smtp.write_raw_data(conn, message);
    END;
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
    data IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    begin_attachment(conn, mime_type, inline, filename);
    write_text(conn, data);
    end_attachment(conn, last);
    END;
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
    data IN RAW,
    mime_type IN VARCHAR2 DEFAULT 'application/octet',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    -- Split the Base64-encoded attachment into multiple lines
    i := 1;
    len := utl_raw.length(data);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
    utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i,
    MAX_BASE64_LINE_WIDTH)));
    ELSE
    utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i)));
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    end_attachment(conn, last);
    END;
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    inline IN BOOLEAN DEFAULT TRUE,
    filename IN VARCHAR2 DEFAULT NULL,
    transfer_enc IN VARCHAR2 DEFAULT NULL) IS
    BEGIN
    write_boundary(conn);
    write_mime_header(conn, 'Content-Type', mime_type);
    IF (filename IS NOT NULL) THEN
    IF (inline) THEN
    write_mime_header(conn, 'Content-Disposition',
    'inline; filename="'||filename||'"');
    ELSE
    write_mime_header(conn, 'Content-Disposition',
    'attachment; filename="'||filename||'"');
    END IF;
    END IF;
    IF (transfer_enc IS NOT NULL) THEN
    write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END;
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
    last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (last) THEN
    write_boundary(conn, last);
    END IF;
    END;
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    end_mail_in_session(conn);
    end_session(conn);
    END;
    FUNCTION begin_session RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    -- open SMTP connection
    conn := utl_smtp.open_connection(smtp_host, smtp_port);
    utl_smtp.helo(conn, smtp_domain);
    RETURN conn;
    END;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2 is
    l_str varchar2(2000);
    begin
    l_str:=utl_raw.cast_to_varchar2(utl_encode.quoted_printable_encode(utl_raw.cast_to_raw(p_str)));
    l_str:=replace(l_str,'='||chr(13)||chr(10),''); --unfold the data
    l_str:=replace(l_str,'?','=3f'); --quote question marks
    l_str:=replace(l_str,' ','=20'); --quote spaces
    l_str:='=?'||p_charset||'?Q?'||l_str||'?='; -- add prefix and suffix
    return l_str;
    end;
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
    sender IN VARCHAR2,
    recipients IN VARCHAR2,
    subject IN VARCHAR2,
    mime_type IN VARCHAR2 DEFAULT 'text/plain',
    -- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
    priority IN PLS_INTEGER DEFAULT NULL) IS
    my_recipients VARCHAR2(32767) := recipients;
    my_sender VARCHAR2(32767) := sender;
    BEGIN
    -- Specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, get_address(my_sender));
    -- Specify recipient(s) of the email.
    WHILE (my_recipients IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_address(my_recipients));
    END LOOP;
    -- Start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    write_mime_header(conn, 'From', sender);
    -- Set "To" MIME header
    write_mime_header(conn, 'To', recipients);
    -- Set "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- write_mime_header(conn, 'Content-Type', 'text/html; charset=UTF-8');
    -- Set "Subject" MIME header
    -- write_mime_header(conn, 'Subject', subject);
    -- write_mime_header(conn, 'Subject', CONVERT(subject,'IW8ISO8859P8'));
    write_mime_header(conn, 'Subject',mimeheader_encode(p_str => subject,p_charset => 'UTF-8'));
    -- write_mime_header(conn, 'Subject',CONVERT(subject,'IW8MSWIN1255'));
    -- Set "X-Mailer" MIME header
    write_mime_header(conn, 'X-Mailer', MAILER_ID);
    -- Set priority:
    -- High Normal Low
    -- 1 2 3 4 5
    IF (priority IS NOT NULL) THEN
    write_mime_header(conn, 'X-Priority', priority);
    END IF;
    -- Send an empty line to denotes end of MIME headers and
    -- beginning of message body.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (mime_type LIKE 'multipart/mixed%') THEN
    write_text(conn, 'This is a multi-part message in MIME format.' ||
    utl_tcp.crlf);
    END IF;
    END;
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.close_data(conn);
    END;
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.quit(conn);
    END;
    END;

  • Convert byte array to table of int

    [http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print|http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print] Hello friends.
    I'm pretty new with PL/SQL.
    I have code that run well on MSSQL and I want to convert it to PL/SQL with no luck.
    The code converts byte array to table of int.
    The byte array is actually array of int that was converted to bytes in C# for sending it as parameter.
    The TSQL code is:
    CREATE FUNCTION dbo.GetTableVarchar(@Data image)
    RETURNS @DataTable TABLE (RowID int primary key IDENTITY ,
    Value Varchar(8000))
    AS
    BEGIN
    --First Test the data is of type Varchar.
    IF(dbo.ValidateExpectedType(103, @Data)<>1) RETURN
    --Loop thru the list inserting each
    -- item into the variable table.
    DECLARE @Ptr int, @Length int,
    @VarcharLength smallint, @Value Varchar(8000)
    SELECT @Length = DataLength(@Data), @Ptr = 2
    WHILE(@Ptr<@Length)
    BEGIN
    --The first 2 bytes of each item is the length of the
    --varchar, a negative number designates a null value.
    SET @VarcharLength = SUBSTRING(@Data, @ptr, 2)
    SET @Ptr = @Ptr + 2
    IF(@VarcharLength<0)
    SET @Value = NULL
    ELSE
    BEGIN
    SET @Value = SUBSTRING(@Data, @ptr, @VarcharLength)
    SET @Ptr = @Ptr + @VarcharLength
    END
    INSERT INTO @DataTable (Value) VALUES(@Value)
    END
    RETURN
    END
    It's taken from http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print.
    The C# code is:
    public byte[] Convert2Bytes(int[] list)
    if (list == null || list.Length == 0)
    return new byte[0];
    byte[] data = new byte[list.Length * 4];
    int k = 0;
    for (int i = 0; i < list.Length; i++)
    byte[] intBytes = BitConverter.GetBytes(list);
    for (int j = intBytes.Length - 1; j >= 0; j--)
    data[k++] = intBytes[j];
    return data;
    I tryied to convert the TSQL code to PL/SQL and thats what I've got:
    FUNCTION GetTableInt(p_Data blob)
    RETURN t_array --t_array is table of int
    AS
    l_Ptr number;
    l_Length number;
    l_ID number;
    l_data t_array;
    BEGIN
         l_Length := dbms_lob.getlength(p_Data);
    l_Ptr := 1;
         WHILE(l_Ptr<=l_Length)
         loop
              l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
              IF(l_ID<-2147483646)THEN
                   IF(l_ID=-2147483648)THEN
                        l_ID := NULL;
                   ELSE
                        l_Ptr := l_Ptr + 4;
                        l_ID := to_number( DBMS_LOB.SUBSTR(p_Data, 4,l_ptr));
                   END IF;
                   END IF;
    l_data(l_data.count) := l_ID;
              l_Ptr := l_Ptr + 4;
         END loop;
         RETURN l_data;
    END GetTableInt;
    This isn't work.
    This is the error:
    Error report:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    06502. 00000 - "PL/SQL: numeric or value error%s"
    I think the problem is in this line:
    l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
    but I don't know how to fix that.
    Thanks,
    MTs.

    I'd found the solution.
    I need to write:
    l_ID := utl_raw.cast_to_binary_integer( DBMS_LOB.SUBSTR(p_Data, 4,l_ptr));
    instead of:
    l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
    The performance isn't good, it's take 2.8 sec to convert 5000 int, but it's works.

Maybe you are looking for

  • HT5381 i did a software update and now mail wont open at all

    Help......my mail app is coming up with an error "You can't use this version of Mail with this version of Mac OS X".  Can I uninstall the update?

  • Connection pooling in a JSP

    I hava an application that uses both a servlet and a JSP and I need to use connection pooling. I have a connectionPool class that works fine in the servlet. I create the pool in my init() method and access it when needed in doGet(). I would like to d

  • I've updated and rearranged my music files so how do i update my itunes library?

    maybe just a noob quesion. but where do I go to update my folder/files for itunes? I just rearranged/deleted/updated my music files onmy computer, will itunes automatically sync/update evertyhing?

  • WEP works fine but WPA doesn't

    I'm using the WRT54G2 router and the WUSB54GC adapter, when I use WEP security the signal strength and connection is good, but when I try to use WPA, the connection keeps dropping and when it does connect, the signal strength is usually low to very l

  • Use of field selection Key.

    Hello I am implementing  the release strategy for the Purchase requisition. can anyone please tell me what is the significance of "Field selection key" and "Value change" under the release indicator. Regards