Display BLOB from remote database

Context: We are offloading documents (pdf) from our OLTP database to a dedicated 'output database.' These documents must be displayed from the application on our OLTP database using a database link. Various posts show that querying a BLOB from a remote database can best be implemented using a query on the remote table and an insert on a local (temporary) table. So far, so good. The idea is to display this BLOB using wpg_docload.download_file.
BUT:
When trying to display the pdf from this global temporary table an error occurs:
ORA-14453: attempt to use a LOB of a temporary table, whose data has already been purged
When trying to display from a normal table and issuing a rollback after wpg_docload.download_file results in another error:
ORA-22922: nonexistent LOB value
When trying to display from a normal table and not removing the record in any way, its works fine. Only I now have a garbage collection issue, because the remote date remain in my local (preferably temporary) table.
It seems to me that mod_plsql needs an active session to display my pdf.
Does anyone have an explanation for this behaviour and maybe a solution for my problem?
Environment:
local: 10.2.0.4.0
remote: 11.1.0.7.0
pdf size: ca. 150kB
code used:
PROCEDURE show_doc (p_nta_id IN NUMBER
,p_sessie IN NUMBER
IS
t_lob BLOB;
t_lob2 BLOB := empty_blob();
t_mime VARCHAR2(100);
BEGIN
-- copy BLOB into local global temp table
INSERT INTO mvs_tmp_notaprint_bestanden
npv_nta_id
, npv_npe_sessie
, mime_type
, bestand
) -- from remote table
SELECT npd.npv_nta_id
,npd.npv_npe_sessie
,npd.mime_type
,npd.bestand
FROM mvs_notaprint_bestanden@marc npd
WHERE npd.npv_nta_id ; = p_nta_id
AND npd.npv_npe_sessie = p_sessie
-- show BLOB from local global temp table
SELECT t.bestand
, t.mime_type
INTO t_lob
, t_mime
FROM mvs_tmp_notaprint_bestanden t
WHERE t.npv_nta_id ; = p_nta_id
AND t.npv_npe_sessie ; = p_sessie
t_lob2 := t_lob; -- buffer BLOB
owa_util.mime_header(t_mime , FALSE );
owa_util.http_header_close;
wpg_docload.download_file(t_lob2);
END show_doc;

Andrew,
thank you, the 'preserve rows' did the trick.
Every query from a browser (even in the same browser session) is a new Oracle session, so the copied records in the global temporary table are gone after the page is displayed.
Am I correct in assuming that each call from the browser results in a new Oracle session? I did a few tests and found for each call a different sessionid.
Sincerly,
Arne Suverein
Edited by: Arne Suverein on Aug 18, 2009 3:35 PM

Similar Messages

  • Getting error while calling procedure from remote database

    When I am trying to call child procedure from remote database I am getting below error:
    ORA-02064: distributed operation not supported
    ORA-06512: at "NMUSER.NEW_CUST_UPLOAD", line 740
    (P.S. on line no 740 I issued "commit;" )
    I checked rights,synonym on all the objects they are fine.

    Oracle Error: ORA-02064
    Error Description:
    Distributed operation
    not supported
    Error Cause:
    One of the following
    unsupported operations was attempted:
    1. array execute of a remote update with a subquery that references a dblink,
    or
    2. an update of a long column with bind variable and an update of a second
    column with a subquery that both references a dblink and a bind variable, or
    3. a commit is issued in a coordinated session from an RPC procedure call
    with OUT parameters or function call.
    Cheers,
    Manik.

  • Walkthrough: Displaying Data from Oracle database in a Windows application.

    This article is intended to illustrate one of the most common business scenarios such as displaying data from Oracle database on a form in a Windows application using DataSet objects and .NET Framework Data Provider for Oracle.
    You can read more at http://www.c-sharpcorner.com/UploadFile/john_charles/WalkthroughDisplayingDataOracleWindowsapplication05242007142059PM/WalkthroughDisplayingDataOracleWindowsapplication.aspx
    Enjoy my article.

    hi,
    this is the code :
    public class TableBean {
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    public List getperInfoAll() {
    int i = 0;
    try
    con = DriverManager.getConnection("url","root","root");
    ps = con.createStatement();
    rs = ps.executeQuery("select * from user");
    while(rs.next()){
    System.out.println(rs.getString(1));
    perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2),rs.getString(3)));
    i++;
    catch (Exception e)
    System.out.println("Error Data : " + e.getMessage());
    return perInfoAll;
    public class perInfo {
    String uname;
    String firstName;
    String lastName;
    public perInfo(String firstName,String lastName,String uname) {
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    public String getUname() {
    return uname;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    ADF table code:
    <af:table value="#{tableBean.perInfoAll}" var="row"
    binding="#{backing_Display.table1}" id="table1">
    <af:column sortable="false" headerText=""
    align="start">
    <af:outputText value="#{row.firstName"/>//---> Jdeveloper 11g doesn't allow me to use this.. it says firstName is an unknown property..
    </af:column>
    </af:table>
    Please tell me is this the way to do it.. or is it a must to use the DataCollection from the data controls panel...
    Thanks...

  • Displaying BLOB from Database

    Hi All,
    I am trying to preview a 'jpeg' image which is stored in my database. The images get inserted into the DB without any trouble, but on retrieving the images I get 'broken links' to the images. Please Help:
    PROCEDURE GET_TEAM_LOGO(team_name VARCHAR2)
    AS
    vblob BLOB;
    buf RAW(32000);
    buf_size INTEGER := 32000;
    offset INTEGER := 1;
    len NUMBER;
    mime_type VARCHAR2(30);
    BEGIN
    auth_proc;
    -- get image_data and its mime type from the database
    WHERE LOGO_ID=position;
    htp.p('This is the value of team:'|| team_name ||'<br>');
    SELECT logo_image, logo_type INTO vblob, mime_type
    FROM LOGO_TABLE
    WHERE group_name = team_name;
    -- set the mime type for the http protocol
    owa_util.mime_header('image/jpeg');
    -- read the data with htp package
    len:=dbms_lob.getlength(vblob);
    WHILE offset < len LOOP
    dbms_lob.read(vblob,buf_size,offset,buf);
    htp.prn(utl_raw.cast_to_varchar2(buf));
    offset:=offset+buf_size;
    END LOOP;
    -- check for exception
    EXCEPTION
    WHEN OTHERS THEN
    htp.p(SQLCODE || SQLERRM);
    END;
    Thanks,
    Peter

    Hi!
    I've used this code successfylly in a mod_plsql procedure.
    Can be used as following:
    htp.img('http://yourhost:port/<dad>/image.get_image?p_picture_id=123,'"right"',null,null,'width=107 height=66 border=1');
    procedure get_image
    ( p_picture_id number
    ) as
    cursor c_pict
    ( b_picture_id number
    ) is
    select pict.picture -- blob column
    , pict.format -- Gif/Jpeg etc.
    from pictures pict
    where pict.picture_id = b_picture_id
    r_pict c_pict%rowtype;
    v_blob BLOB;
    v_amt NUMBER := 30;
    v_off NUMBER := 1;
    v_raw RAW(4096);
    begin
    open c_pict(p_picture_id);
    fetch c_pict into r_pict;
    if c_pict%notfound
    then
    close c_pict;
    else
    close c_pict;
    owa_util.mime_header('image/'||r_pict.format);
    begin
    loop
    dbms_lob.read(r_pict.picture,v_amt,v_off,v_raw);
    htp.prn(utl_raw.cast_to_varchar2(v_raw));
    v_off := v_off+v_amt;
    v_amt := 4096;
    end loop;
    exception
    when no_data_found
    then
    null;
    end;
    end if;
    end get_image;

  • Access blob/ord column from remote database

    Hi,
    I am using oracle 10.2.
    I have two database X and Y and on Y database i have the table B with column ORDDOC.
    The db link is created on A to access all tables of B. I can access all tables from B except X.
    Could you please advise how can i access table X from B database.
    Database - Y
    SQL> desc B;
    Name Null? Type
    ATTACHMENT_ID NOT NULL NUMBER(38)
    ATTACHMENT ORDSYS.ORDDOC
    SQL>
    Database - X
    SQL> select * from B@DB_LINK_TRDX2.WORLD;
    select * from B@DB_LINK_TRDX2.WORLD
    ERROR at line 1:
    ORA-22804: remote operations not permitted on object tables or user-defined
    type columns
    SQL>
    Anybody could help pls ?

    Kapil wrote:
    The document is in different database and used by other schemas as well from that database.
    .Net is GUI.Daniel raised a very important point. Moving that document via another database doubles the network load for that operation. And doubles the performance impact on the client.
    Is this in any way a sensible thing to do? Most definitely not.
    Assuming that the client cannot reach the remote database containing the documents, and that can only be done via the local database, then you need to look at options such as materialised views. Replicate the remote content from the remote database to the local database at regular intervals.
    As the data set is large (containing LOB documents), consider fast incremental refreshing (and not pull the entire data set across with each refresh).
    Yes, you can write PL/SQL code that grabs the remote document and copies it into a local LOB and then dish that up to the client. But the impact of this on the network and performance are major concerns that need to be thoroughly evaluated first.

  • Insert a blob in remote database using dblink

    i have a view (it has a BLOB column) from where i need to select the records. After selecting i need to insert it into a synonym in the remote database through a db link.
    if i execute the procedure i get error; ora-22992--cannot use LOB locators selected from remote table. My code is
    INSERT INTO [email protected]
    SELECT PID,RNO, PTYPE,blob_field
    FROM view;
    I dont wish to creat a temporary table and still wish to perform the above function.
    So is there any method to do this. I tried with DBMS_LOB.APPEND but it didnt work out. Any solution will be greatly appreciated.
    Thanks,
    -Nitin

    i have a view (it has a BLOB column) from where i need to select the records. After selecting i need to insert it into a synonym in the remote database through a db link.
    if i execute the procedure i get error; ora-22992--cannot use LOB locators selected from remote table. My code is
    INSERT INTO [email protected]
    SELECT PID,RNO, PTYPE,blob_field
    FROM view;
    I dont wish to creat a temporary table and still wish to perform the above function.
    So is there any method to do this. I tried with DBMS_LOB.APPEND but it didnt work out. Any solution will be greatly appreciated.
    Thanks,
    -Nitin

  • Getting LONG RAW from remote database

    Hi,
    I have a table in my local database that has a LONG RAW column . I have another table of similar structure in a remote database (so it has LONG RAW as well). I would like to transfer data including LONG RAW data from the remote database into the local database table using PL/SQL. I know it is not possible to copy LONG RAW over dblink directly. Can anyone suggest an approach to accomplish this?
    The local table cannot be changed to BLOB, but I have the flexibility to change the remote table to use BLOB. So, can anyone tell me if the following solution would work. If so, can you shed some light on what PL/SQL libraries to use or can you provide me with some sample code to implement steps 3 and 4 below?:
    1. Change the remote table to use BLOB
    2. Create a new temporary table with BLOB in the local database.
    3. Copy data using PL/SQL from remote BLOB to local temporary table BLOB.
    4. Copy data using PL/SQL from BLOB to LONG RAW within the local database from temporary table (w/ BLOB) to the actual target table (w/ LONG RAW).
    I think step 3 can be a direct Insert-Select from remote table (I'll try this myself), but not sure how to go about step 4.
    Thanks for your help.

    There is a chapter in the Oracle Application Developer's Guide on calling external procedures
    I don't know enough about VB and the available VB APIs to know for sure. I would assume that VB could be configured to generate a DLL with a C call specification. I would also assume that there was a VB API that would allow you to manipulate LONG RAW and BLOB data. Unfortunately, though, I don't know which VB API's have that functionality.
    Justin

  • Error messages from remote database

    Hi.
    While working across database links, usually the error messages occurring on the remote database are displayed without particulars like datafile name, tablespace name, etc. e.g. ORA-03232: unable to allocate an extent of blocks from tablespace , which should ideally say ORA-03232: unable to allocate an extent of 100 blocks from tablespace TEMP. This, probably is because only an error number is passed back from the remote database or because the other parameters passed back are not being picked up properly by the local database (client). Is there any way to get around this? It should not be something like 'add a parameter in the remote procedure for getting back the error text'!
    Thanks,
    Rahul

    The alternative of course is to make your process which does the insert into the table conditional upon the username not already being present in the table. It give you the overhead of an additional data fetch but this should be negliable unless you have a very large table with poor index usage.

  • Help, how to open and display blobs from tables

    Dear all,
    I am trying to store ms-word files on a table using a blob column.
    Does anyone how to open the files and display them from a form using 9iAS?
    Thank you.
    Carlos.

    And there may be, but you won't likely find that here. Do some time searching Google and maybe you'll find code that someone was nice enough to make freely available, although I wouldn't count on it. Were i a programmer and took the time to read those docs and write the code, I'd want to be paid for my time. But there are a lot of programmers who swear by freeware! You may get lucky.

  • How to display data from a database to a  JComboBox  JTextField

    Hello
    I was wondering I have a database called "PAYTYPE" and have a colums called
    EMPLOYEETYPE     PAYBASIC     PAYSUNDAY     PAYHOLIDAY     PAYPERIOD
    What i want to do is display the list of EMPLOYEETYPE in a combo box(Which i got this part working),
         try{
              ResultSet rs = db.getResult("Select * FROM PAYTYPE");
              while(rs.next())
                   payTypeField.addItem(rs.getString(2));
              }catch(SQLException e)
              }When an item is selected from the combo box then the information thats in PAYBASIC,PAYSUNDAY,PAYHOLIDAY, PAYPERIOD will be displayed in textfields
    this is the problem im trying to solve
    Any Ideas ??????

    What im trying to do is the following
    on my Gui i have 1 JComboBox and 3 JtextFields
    The Jcombo box is populated by the data base
    try{     
              ResultSet rs = db.getResult("Select * FROM EMPLOYEEPAYTYPE");
              while(rs.next())
                   payTypeField.addItem(rs.getString(2));
              }catch(SQLException e)
              }Now that i have the JComboBox filled I want the other 3 JTextField to be populated with the information that been selected by the JComboBox
    I under stand there needs to be a .addActionListener(this) to the JComboBox
                    payTypeField = new JComboBox();
                payTypeField.setBounds(130, 10,100,20);
                payTypeField.addActionListener(this);
                payTypeField.addItemListener(this);
                 c.add(payTypeField);I would just like the steps that i need to take in order to fill the JTextBoxes in pudoscode
    The information that i need will need to be pulled from the database - EMPLOYEEPAYTYPE
    Thanks
    Jon

  • Trying to display results from access database query on a JSP

    Seem to be having real difficulty with this one, i keep getting a null pointer exception :(. Wondered if anyone could point me to any examples of displaying the results on jsp. The database is connected, as i can display the query on netbeans, but just not on a jsp.

    I think it would be good if we had a section in these forums for pre-canned answers to the same questions that come up again and again. It would save time.
    Here is a rough outline for using JSP:
    * Read a JSP book.
    * The JSP page (View in MVC) should get all the data it needs to display from a useBean and/or request.getAttribute().
    * The JSP page should not have any business logic. Its purpose is to display data only (and have some submit buttons such as 'update').
    You can do some basic client side validation using javascript if you want. Because there is no business logic in it, you can easily debug
    your code in the servlet or business logic. You can't set breakpoints in JSP and examine data easily.
    * When you click the submit button, all data from <input type="text" tags, etc is put into request scope via name/value pairs.
    * Submit the JSP page <form tag to a servlet (Control in MVC).
    * The servlet reads the name/value pairs of data from the JSP page via request.getParameter()
    * The servlet should then instansiate a business object (Model in MVC), passing the data it got from the page to the business logic.
    Example: ProcessPage processPage();
    if(request.getParameter("updateButtonClicked"))
    processPage.updateData(data from the jsp page)
    * The business logic should instansiate a separate database object (DAO) to get data to/from the database. Business logic should not have sql in it.
    Business logic should not generate html. Business logic should not have request objects in it.
    * The business logic should return data to the servlet that in turn will put it in request scope via request.setAttribute() so the JSP page can draw itself.
    * The servlet should then call up the approprate JSP page.

  • How to send e-mail with an attachment from remote database server.???

    Hi All,
    I have tried the simple mail sending and with the attachment using UTL_SMTP. But the problem is , it is sending the mail with attachment of the file name i give, it takes and creates that file and sends as attachment not from the actual file location. I am trying to attach the file which i stored in remote database server.
    The following code I tried. But not worked for attachment
    DECLARE
       v_From       VARCHAR2(80) := '[email protected]';
       v_Recipient  VARCHAR2(80) := '[email protected]';
       v_Subject    VARCHAR2(80) := 'test subject';
       v_Mail_Host  VARCHAR2(30) := 'pop3.somedomain.com';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: '|| v_Subject || crlf ||
        'To: '     || v_Recipient || crlf ||
        'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/html;'|| crlf ||
        'Content-Transfer_Encoding: 7bit'|| crlf ||
        crlf ||
        'some message text'|| crlf ||     -- Message body
        'more message text'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/html;'|| crlf ||
        ' name="Fund Authorization report"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="/usr/tmp/Test.html"'|| crlf ||
        crlf ||
        'HTML Attachment'|| crlf ||     -- Content of attachment
        crlf ||
        '-------SECBOUND--'               -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;How can I attach a file which is stored in database server and send it in a mail.
    Please someone help me in this.
    Thanks,
    Alaka.

    Try this code
    Regards Salim.
    CREATE OR REPLACE TRIGGER EmailOnServerErr AFTER SERVERERROR ON DATABASE
    DECLARE
       mail_conn       UTL_SMTP.connection;
       crlf            VARCHAR2(2) := chr(13)||chr(10);
       msg             VARCHAR2(32760);
       sid_name        VARCHAR2(16);
       bdump_dest      VARCHAR2(128);
       smtp_relay      VARCHAR2(32) := 'MyMailRelay';
       recipient_address  VARCHAR2(64) := '[email protected]';
       sender_address     VARCHAR2(64) := '[email protected]';
       mail_port       NUMBER := 25;
       log_file_handle UTL_FILE.FILE_TYPE;
       log_file_dir    VARCHAR2(256) := 'ERR_LOG_DIR';
       log_file_name   VARCHAR2(256) := 'OracleErrors.log';
       maxlinesize     NUMBER := 32767;
       session_rec     sys.v_$session%ROWTYPE;
       audit_rec       sys.dba_audit_trail%ROWTYPE;
       auditing        BOOLEAN;
       LinesOfSQL      BINARY_INTEGER;
       offending_sql   DBMS_STANDARD.ora_name_list_t;
       CURSOR bdump_cur IS
          SELECT TRIM(value)
          FROM v$parameter
          WHERE name = 'background_dump_dest'
       CURSOR sid_cur IS
          SELECT TRIM(instance_name)
          FROM v$instance
       CURSOR session_cur IS
          SELECT s.*
          FROM v$session s
          WHERE s.sid = dbms_support.mysid
       CURSOR audit_trail_cur(AUDSID IN NUMBER) IS
          SELECT *
          FROM dba_audit_trail
          WHERE sessionid = AUDSID
    BEGIN
       IF (USER = 'SYSTEM' OR USER = 'SYS') THEN
          -- Ignore this error
          NULL;
       ELSIF IS_SERVERERROR (1034) THEN
          -- Ignore this error
          NULL;
       ELSE
          -- get the sid
          OPEN sid_cur;
          FETCH sid_cur INTO sid_name;
          CLOSE sid_cur;
          -- get the location of the alert log
          OPEN bdump_cur;
          FETCH bdump_cur INTO bdump_dest;
          CLOSE bdump_cur;
          -- get the session information
          OPEN session_cur;
          FETCH session_cur INTO session_rec;
          CLOSE session_cur;
          -- get the audit_trail information if it exists
          OPEN audit_trail_cur(session_rec.audsid);
          FETCH audit_trail_cur INTO audit_rec;
          auditing := audit_trail_cur%FOUND;
          CLOSE audit_trail_cur;
          IF session_rec.program = 'MyProgram.exe' THEN
             NULL;  -- ignore actions from MyProgram - that's where I do maintenance
          ELSE
             -- compose the message
             msg := 'Subject: Oracle error '||' on '||sid_name||crlf;
             msg := msg||'To: '||recipient_address||crlf;
             msg := msg||'For more information see the alert log file located at:'||crlf;
             msg := msg||bdump_dest||'/alert_'||sid_name||'.log'||crlf;
             msg := msg||'or the error log file: $'||log_file_dir||'/'||log_file_name||crlf;
             msg := msg||'Error Time='||TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS')||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_CALL_STACK||crlf;
             LinesOfSQL := sql_txt(offending_sql);
             msg := msg||'Offending SQL is:'||crlf;
             FOR loop_counter IN offending_sql.FIRST..offending_sql.LAST
             LOOP
                msg := msg||offending_sql(loop_counter);
             END LOOP;
             msg := msg||crlf||'----- PL/SQL Error Stack -----'||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_ERROR_STACK||crlf;
             msg := msg||'V$SESSION.SADDR='   ||session_rec.saddr   ||crlf;
             msg := msg||'V$SESSION.SID='     ||session_rec.sid     ||crlf;
             msg := msg||'V$SESSION.SERIAL#=' ||session_rec.serial# ||crlf;
             msg := msg||'V$SESSION.AUDSID='  ||session_rec.audsid  ||crlf;
             msg := msg||'V$SESSION.PADDR='   ||session_rec.paddr   ||crlf;
             msg := msg||'V$SESSION.USER#='   ||session_rec.user#   ||crlf;
             msg := msg||'V$SESSION.USERNAME='||session_rec.username||crlf;
             msg := msg||'V$SESSION.COMMAND=' ||session_rec.command ||crlf;
             msg := msg||'V$SESSION.OWNERID=' ||session_rec.ownerid ||crlf;
             msg := msg||'V$SESSION.TADDR='   ||NVL(session_rec.taddr   ,'Null')||crlf;
             msg := msg||'V$SESSION.LOCKWAIT='||NVL(session_rec.lockwait,'Null')||crlf;
             msg := msg||'V$SESSION.STATUS='  ||NVL(session_rec.status  ,'Null')||crlf;
             msg := msg||'V$SESSION.SERVER='  ||NVL(session_rec.server  ,'Null')||crlf;
             msg := msg||'V$SESSION.SCHEMA#=' ||session_rec.schema#||crlf;
             msg := msg||'V$SESSION.SCHEMANAME=' ||NVL(session_rec.schemaname,'Null')||crlf;
             msg := msg||'V$SESSION.OSUSER='     ||NVL(session_rec.osuser    ,'Null')||crlf;
             msg := msg||'V$SESSION.PROCESS='    ||NVL(session_rec.process   ,'Null')||crlf;
             msg := msg||'V$SESSION.MACHINE='    ||NVL(session_rec.machine   ,'Null')||crlf;
             msg := msg||'V$SESSION.TERMINAL='   ||NVL(session_rec.terminal  ,'Null')||crlf;
             msg := msg||'V$SESSION.PROGRAM='    ||NVL(session_rec.program   ,'Null')||crlf;
             msg := msg||'V$SESSION.TYPE='       ||NVL(session_rec.type      ,'Null')||crlf;
             msg := msg||'V$SESSION.SQL_ADDRESS='    ||session_rec.sql_address  ||crlf;
             msg := msg||'V$SESSION.SQL_HASH_VALUE=' ||NVL(TO_CHAR(session_rec.sql_hash_value) ,'Null')||crlf;
             msg := msg||'V$SESSION.PREV_SQL_ADDR='  ||session_rec.prev_sql_addr||crlf;
             msg := msg||'V$SESSION.PREV_HASH_VALUE='||NVL(TO_CHAR(session_rec.prev_hash_value),'Null')||crlf;
             msg := msg||'V$SESSION.MODULE='     ||NVL(session_rec.module              ,'Null')||crlf;
             msg := msg||'V$SESSION.MODULE_HASH='||NVL(TO_CHAR(session_rec.module_hash),'Null')||crlf;
             msg := msg||'V$SESSION.ACTION='     ||NVL(session_rec.action              ,'Null')||crlf;
             msg := msg||'V$SESSION.ACTION_HASH='||NVL(TO_CHAR(session_rec.action_hash),'Null')||crlf;
             msg := msg||'V$SESSION.CLIENT_INFO='||NVL(session_rec.client_info         ,'Null')||crlf;
             msg := msg||'V$SESSION.FIXED_TABLE_SEQUENCE='||NVL(TO_CHAR(session_rec.fixed_table_sequence),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_OBJ#='  ||NVL(TO_CHAR(session_rec.row_wait_obj#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_FILE#=' ||NVL(TO_CHAR(session_rec.row_wait_file#) ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_BLOCK#='||NVL(TO_CHAR(session_rec.row_wait_block#),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_ROW#='  ||NVL(TO_CHAR(session_rec.row_wait_row#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.LOGON_TIME='     ||NVL(TO_CHAR(session_rec.logon_time,'DD-Mon-YYYY HH24:MI:SS'),'Null')||crlf;
             msg := msg||'V$SESSION.LAST_CALL_ET='   ||NVL(TO_CHAR(session_rec.last_call_et)   ,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_ENABLED='   ||NVL(session_rec.pdml_enabled   ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_TYPE='  ||NVL(session_rec.failover_type  ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_METHOD='||NVL(session_rec.failover_method,'Null')||crlf;
             msg := msg||'V$SESSION.FAILED_OVER='    ||NVL(session_rec.failed_over    ,'Null')||crlf;
             msg := msg||'V$SESSION.RESOURCE_CONSUMER_GROUP='||NVL(session_rec.resource_consumer_group,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_STATUS='    ||NVL(session_rec.pdml_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PDDL_STATUS='    ||NVL(session_rec.pddl_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PQ_STATUS='      ||NVL(session_rec.pq_status      ,'Null')||crlf;
             IF auditing THEN
                msg := msg||'DBA_AUDIT_TRAIL.OS_USERNAME='  ||NVL(audit_rec.os_username,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERNAME='     ||NVL(audit_rec.username   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERHOST='     ||NVL(audit_rec.userhost   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TERMINAL='     ||NVL(audit_rec.terminal   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TIMESTAMP='    ||TO_CHAR(audit_rec.timestamp,'DD-Mon-YYYY HH24:MI:SS')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OWNER='        ||NVL(audit_rec.owner      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_NAME='     ||NVL(audit_rec.obj_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION='       ||audit_rec.action   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION_NAME='  ||NVL(audit_rec.action_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_OWNER='    ||NVL(audit_rec.new_owner     ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_NAME='     ||NVL(audit_rec.new_name      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_PRIVILEGE='||NVL(audit_rec.obj_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SYS_PRIVILEGE='||NVL(audit_rec.sys_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ADMIN_OPTION=' ||NVL(audit_rec.admin_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.GRANTEE='      ||NVL(audit_rec.grantee       ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.AUDIT_OPTION=' ||NVL(audit_rec.audit_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SES_ACTIONS='  ||NVL(audit_rec.ses_actions   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_TIME='  ||NVL(TO_CHAR(audit_rec.logoff_time)  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LREAD=' ||NVL(TO_CHAR(audit_rec.logoff_lread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_PREAD=' ||NVL(TO_CHAR(audit_rec.logoff_pread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LWRITE='||NVL(TO_CHAR(audit_rec.logoff_lwrite),'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_DLOCK=' ||NVL(audit_rec.logoff_dlock  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.COMMENT_TEXT=' ||NVL(audit_rec.comment_text  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SESSIONID='    ||audit_rec.sessionid   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ENTRYID='      ||audit_rec.entryid     ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.STATEMENTID='  ||audit_rec.statementid ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.RETURNCODE='   ||audit_rec.returncode  ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.PRIV_USED='    ||NVL(audit_rec.priv_used,'Null')||crlf;
             END IF;
             msg := msg||'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'||crlf||crlf;
             -- write the message to the error log file
             log_file_handle := UTL_FILE.FOPEN (log_file_dir, log_file_name, 'A',maxlinesize);
             UTL_FILE.PUT_LINE(log_file_handle,msg);
             UTL_FILE.FCLOSE(log_file_handle);
             -- send the message by Email
             mail_conn := UTL_SMTP.open_connection(smtp_relay, mail_port);
             UTL_SMTP.HELO(mail_conn, smtp_relay);
             UTL_SMTP.MAIL(mail_conn, sender_address);
             UTL_SMTP.RCPT(mail_conn, recipient_address);
             UTL_SMTP.DATA(mail_conn, msg);
             UTL_SMTP.QUIT(mail_conn);
          END IF; -- client_program = MyProgram.exe
       END IF;
    END;
    /

  • Display Image from the database but prevent it from refreshing on every pages

    Hi there,
    I can see there are many discussions around this but my query is slightly different. I'm writing this on behalf of one of my developers. (sorry for my ignorance on techie stuff.. :-))
    A logo is being displayed on a few pages, which is called from the database. However, the problem is that  - this logo refreshes every time when you traverse to each page causing a performance issue or sometimes slow loading of the image.
    My question is - how do we stop it from loading on each page from the database?.  I would rather load once when the main page loads initially and then maintain this on other pages too.
    We can keep this logo on a file system (FS)  and display it via CSS/HTML/frame but since we want to keep it flexible/dynamic where a user can upload a new one whenever it changes and hence DB seems to be the suitable option (in my opinion).
    Can someone please help?
    If you need any further info around the coding how it is being done at present, pls let me know.
    Thank you

    read this http://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_tables.htm#g1017777
    you can cache lobs in the database too
    you can also upload the pic in your file system using utl_file package and then put the image in the working directory mentioned in i.war
    you can then reference the image and it will not be stored in the database and will be cached
    Regards,
    Vishal
    Oracle APEX 4.2 Reporting | Packt Publishing
    Vishal's blog

  • Xmltype data can't be copied from remote database

    Hi,
    I got the following same error when copy table with xmltype from different env:
    table localXML(xml xmltype);
    insert into localXML select * from remoteXML@romote;
    1. run from db tools:
    ... Physical database connection acquired for: local
    12:07:41 [INSERT - 0 row(s), 0.000 secs] [Error Code: 22992, SQL State: 99999] ORA-22992: cannot use LOB locators selected from remote tables
    ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
    2. run from sqlplus
    ORA-22992: cannot use LOB locators selected from remote tables
    The above script runs well if two tables are in same database.
    Did any one have solution on this?
    Thanks.
    John

    The standard workaround for this one is to create a synonym or such on the be called object and then do the insert selecting via the synonym. Search google for ORA-22992 and "asktom" and see if this workaround for LOB's also works for xmltype (CLOB) columns/tables.
    What's your database version and how was the remoteXML table created (DDL) ???

  • Trouble creating forms from remote database

    Hi,
    We are having problems with connecting to remote databases with portal. We can create reports fine from the remote databases but when we try to create forms, it gives the error:
    'This Table does not exist or you do not have the required privileges (WWV-13020)'.
    We've created a link to the remote db, and synonyms for each of the tables. I don't understand because it seems we can build reports and other components...just not forms.
    If anyone has any ideas as to what the problem could be, any assistance you may provide is greatly appreciated!
    Thanks!

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitry Nonkin([email protected]):
    Sarah,
    It could be dull, but anyway - make sure that you granted all the required grants (INSERT,UPDATE,DELETE) in addition to SELECT to the application schema.
    Also, at which step of the wizard you recieve this error?
    Thanks,
    Dmitry<HR></BLOCKQUOTE>
    Dmitry - we're having the same problems...
    I've had our DBA team grant us every possible privilage we can find - but I still can't create a form from within the portal to a remote database. The wizard lets me put in the table name, ex. asset.wban_trans@drsrch, and does come up with the proper columns on the layout page of the wizard, but when I click the "Finish" button I get the following errors: Line/Column Error
    733/21 PLS-00454: with a returning into clause, the table expression cannot be remote or a subquery
    733/9 PL/SQL: SQL Statement ignored
    841/16 PLS-00454: with a returning into clause, the table expression cannot be remote or a subquery
    841/9 PL/SQL: SQL Statement ignored
    The form is then listed in my applications list, but if I try and run it I get the following error:
    Error: An unexpected error occurred: ORA-04063: has errors
    ORA-04063: package body "PORTAL.FORM_0305092506" has errors
    ORA-06508: PL/SQL: could not find program unit being called (WWV-16016)
    Thanks for any help....
    Christina
    null

Maybe you are looking for