How to use stored package in form.

hi
i created the following package but now i want to use the following code in form
how could i use?.
create or replace package body mahi
is
-- Write a MIME header
procedure write_mime_header (
p_conn in out nocopy utl_smtp.connection
, p_name in varchar2
, p_value in varchar2
is
begin
utl_smtp.write_data ( p_conn
, p_name || ': ' || p_value || utl_tcp.crlf
end;
procedure mail (
p_sender in varchar2
, p_recipient in varchar2
, p_subject in varchar2
, p_message in varchar2
is
v_nls_charset VARCHAR2(50);
/*LOB operation related varriables */
v_src_loc BFILE := BFILENAME('BACKUP', 'Logon.jpg');
l_buffer RAW(54);
l_amount BINARY_INTEGER := 54;
l_pos INTEGER := 1;
l_blob BLOB := EMPTY_BLOB;
l_blob_len INTEGER;
v_amount INTEGER;
/*UTL_SMTP related varriavles. */
v_connection_handle UTL_SMTP.CONNECTION;
v_from_email_address VARCHAR2(30) := [email protected]';
v_to_email_address VARCHAR2(30) := '[email protected]';
I have used stunnel to send mail using smtp.gmail.com
To get stunnel see http://stunnel.org/.
The ORIGINAL idea is here :
http://monkeyonoracle.blogspot.com/2009/11/plsql-and-gmail-or-utlsmtp-with-ssl.html
v_smtp_host VARCHAR2(30) := 'localhost.localdomain';
v_subject VARCHAR2(30) := 'Your Test Mail';
l_message VARCHAR2(200) := 'This is test mail using UTL_SMTP';
/* This send_header procedure is written in the documentation */
PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
BEGIN
UTL_SMTP.WRITE_DATA(v_connection_handle,
pi_name || ': ' || pi_header || UTL_TCP.CRLF);
END;
BEGIN
SELECT value
INTO v_nls_charset
FROM nls_database_parameters
WHERE parameter = 'NLS_CHARACTERSET';
/*Preparing the LOB from file for attachment. */
DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
l_blob_len := DBMS_LOB.getlength(l_blob);
/*UTL_SMTP related coding. */
v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host,
port => 1925);
UTL_SMTP.EHLO(v_connection_handle, 'gmail.com');
UTL_SMTP.COMMAND(v_connection_handle, 'auth login');
UTL_SMTP.COMMAND(v_connection_handle,
UTL_ENCODE.TEXT_ENCODE('[email protected]',
v_nls_charset,
1));
UTL_SMTP.COMMAND(v_connection_handle,
UTL_ENCODE.TEXT_ENCODE('xxxxx', v_nls_charset, 1));
--UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
--UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
UTL_SMTP.COMMAND(v_connection_handle,
'MAIL FROM: <'>');
UTL_SMTP.COMMAND(v_connection_handle,
'RCPT TO: <'>');
UTL_SMTP.OPEN_DATA(v_connection_handle);
send_header('From', '"Sender" <'>');
send_header('To', '"Recipient" <'>');
send_header('Subject', v_subject);
--MIME header.
UTL_SMTP.WRITE_DATA(v_connection_handle,
'MIME-Version: 1.0' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' boundary= "' || 'BACKUP.SECBOUND' || '"' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Body
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'BACKUP.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: text/plain;' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' charset=US-ASCII' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Attachment
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'BACKUP.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: application/octet-stream' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' filename="' || 'Logon.jpg' || '"' || --My filename
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
/* Writing the BLOL in chunks */
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
UTL_SMTP.write_raw_data(v_connection_handle,
UTL_ENCODE.BASE64_ENCODE(l_buffer));
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
l_buffer := NULL;
l_pos := l_pos + l_amount;
END LOOP;
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Close Email
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'BACKUP.SECBOUND' || '--' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
UTL_SMTP.CLOSE_DATA(v_connection_handle);
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
EXCEPTION
WHEN OTHERS THEN
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
RAISE;
END;
end;
sarah helped me to create the above package but i am not able to use in form
i sent email to her but no reply.

hi
mehwish............just do for attachment.......
u can also use something like this...
Execute send_mail;and also.
try something like this..
example:
begin
mahi.mail('email address','subject','message','attachment');
end;Edited by: Sarah on Apr 18, 2011 10:25 AM

Similar Messages

  • How to use Stored Procedures in form 6i Blocks

    Dear Friends,
    I would like to know how to use Stored Procedures while creating blocks in Data Block Wizard in forms 6i application.
    Please send me sample code of stored procedure.
    Regards,
    Khader.

    The Data Block Wizard is not for creating stored procedures. It will allow you to use a stored procedure in your form. See the help documentation for how to use the wizard.
    Here's an example of a simple procedure. If you search the database forum or the web, you will find many examples.
    CREATE OR REPLACE PROCEDURE procedure_name (value OUT NUMBER ) AS
    BEGIN
    SELECT COUNT(*) INTO value
    FROM your_table;
    END;
    Message was edited by:
    Mark Roberts

  • How to use DDE package in form 10g module

    Hi All,
    I am using DDE.package in form 10g for uploading excels data in oracle database at windows platform but it is showing non-oracle exception.
    Thanks

    hi
    mehwish............just do for attachment.......
    u can also use something like this...
    Execute send_mail;and also.
    try something like this..
    example:
    begin
    mahi.mail('email address','subject','message','attachment');
    end;Edited by: Sarah on Apr 18, 2011 10:25 AM

  • How to use stored procedures in DIAdem and Can the stored procedures be used to return values?

    Can anyone please tell me how to use stored procedures in diadem and to return values from it. Its really important, can you please answer it at the earliest.
    Thanks In advance
    spiya

    Hi Spria,
    I'm very sorry for the mix-up, I thought Allen was going to answer you back with the particulars that we found out. Check out the attached Word document and the below tidbits:
    The built-in DIAdem ODBC functions {SQL_...()} can only call stored functions, which return a scaler result {found then in SQL_Result(1,1)}. The syntax for this with an ORACLE db is
    "select function(parameters) from package"
    ...where package defaults to "dual" if you don't use your own package.
    There might be exceptions to that though, and the syntax will be different for other databases. Note that stored ORACLE procedures can NOT be called from the ODBC functions, instead you must use either ADO function calls in the DIA
    dem VBScript or the OO4O COM wrapper that ORACLE provides (this is described in further detail in the below Word document).
    Hope this helps,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Calling_ORACLE_Stored_Procedures_from_DIAdem.doc ‏28 KB

  • How to use Stored Procedure Call in Sender JDBC adapter

    Hi All,
             Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
    Xier

    Hi Xler
    refer these links
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also, you can check Sriram's blog for executing Stored Procedures,
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    /people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
    This blog might be helpfull on stored procedures for JDBC
    JDBC Stored Procedures
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Please go through these threads and see if it helps...
    Re: How to execute Stored Procedure?
    Re: Problem with JDBC stored procedure
    Thnaks !!

  • HOW TO USE STORED PROCEDURES IN JASPERREPORTS(URJENT)

    Hi,
    i'm using jasperreports in struts based project. How to use stored procedures in jasperreports. pls send the solution urjent
    Thanks in advance
    ramesh

    Hi,
    Refer the below link:
    JDBC:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
    refer the below link which has all the associated action
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    Chirag

  • How to use Stored Procedures in JDBC sender side and receiver side

    Hello,
    Can anyone explain how to use stored procedures in configuring the scenario using JDBC adapter at bothe sides sender nad receiver..
    Thanks,
    Soorya

    Hi,
    Refer the below link:
    JDBC:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
    refer the below link which has all the associated action
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    Chirag

  • How to use css in oracle forms

    Hello,       I am using oracle forms 11g with weblogic server 10.3.5 at windows 7.I have to use CSS in oracle forms.i have tried to search it but no profit.please some one else tell me that how can use css in oracle forms. Thnak You regards aaditya

    Hi
    As Francois pointed out Oracle forms has nothing to do with html based technology. The way you can get the equivalent effect of creating consistancy in the way your objects are displayed is by creating a set of items you want and alter their apperance and behaviour and place them into object libraries (one library should do the trick).  From there you subclass all of you forms items off these libraries.
    Regards
    Quintin

  • How to use utl_ftp package to transfer files from one system to another

    Hi all,
    How to use utl_ftp package to transfer files from one system to another using plsql procedure .
    I failed to find the appropriate document ,kindly help me .
    Thanks,
    P Prakash

    prakash wrote:
    I am sorry tell you, this blog is not enough to for me.It's not a blog, it's Chris' website where you download the package from. Once you download the package and unrar it, then the package spec gives instructions (and I think there's instructions on how to install it too).
    Kindly let me know if there is any oracle documentation for this .It's not an Oracle created package, it was created by Chris. It's based around the UTL_TCP package if you really want to get into the nitty gritty of how it works, but I don't think you do.

  • How to use LDAP with Oracle forms 10g on Oracle application server

    Hi,
    I need some help on this. I have developed oracle forms 10g on application server 9iAS. The client want to use the existing LDAP authentication to the software we wrote. I do not know how I could configure to use the existing LDAP authentication . If anyone know how would I use the existing LDAP on different server to use when they logon to our menu in 10g to validate the user. Do I need to add any varibales in formweb.cfg or any other method. Please help.
    Thanks
    Luksh

    I am not quite sure if this works out of the box. According to an Oracle FAQ:
    4.2 Can I use LDAP to authenticate Forms Services?
    Not directly. However, Oracle Login Server is able to authenticate against a LDAP directory and thus a Forms application can take advantage of this in a SSO environment. But you cannot use access control information stored in a LDAP directory with Forms.

  • How to use Stored Procedure in RPD

    In the physical layer we have a option for procedure when we select a tables general tab.I created the procedure
    but i am not able to retrieve values in the Dashboard.
    Could anyone help me with this as how to use procedure.

    Oracle stored procedure don't return recordssets. You have to put the result of the stored procedure in a global temp table and reference the rpd to that table. the execution of the stored procedure can be triggerd form the "execute before query" part in the connection pool.
    regards
    John
    http://obiee101.blogspot.com/

  • How to use a packaged Jar File?

    Greetings to everyone reading this post!
    I have a query about a thing that seems to be basic but I don't know how to accomplish, here it goes:
    I have packaged a Simple application into a Jar file. this application contains a package like this:
    lib.demo, inside this package I have a Class named MyClass with some simple methods like this one:
    public void sayHi(String name){
    //implementation here
    }Now, I would like to Know how to use the Method sayHI(String name) from an entirely different Project. I have successfully included the Jar File as a Library(in the new Project), but I have I no Clue on How to invoke a Class inside my Jar library, and more Importantly, a method.
    Could anybody help me?

    if the "project" (not a Java-related system, it's IDE-specific) already includes the JAR file in its classpath (library), then all you need is to import the package/class and invoke the method, as such:
    // in your client code:
    import lib.demo.*;         // or, import lib.demo.MyClass;
    public class Test {
      public void inAMethod() {
        MyClass myC = new MyClass();
        myC.sayHi("say hi"); 
    }simple.

  • Tutorial Announcement :: How To Use Auto Complete Text Form Control ::

    Hello Everyone...
    Here in this tutorial we gonna to learn a new and amazing feature of (ADDT), we will learn how to use Adobe developer toolbox (ADDT) form controls.
    Form controls help you to add a fantastic features to your forms, that helps you to expand the form abilities and functionality...
    The Auto complete Text Field is an enhanced text field that dynamically completes what you type with matched values from a table. You can also select the values from a list.
    You can use the Auto complete Text Field in user registration forms, such as allowing users to select their country or city easier, Also in other forms that needs the user to pick one of many choices without any difficulties.
    Requirements
    To complete this tutorial you will need to install the following software and files:
    Adobe Dreamweaver Cs3
    Adobe Developer Toolbox (ADDT)
    Don't forget: to try out the Demo type the first three letters :A - B - C
    :: Go To Tutorials ::
    :: Go To Tutorials ::
    Best Regards
    Waleed Barakat
    Developer-Online Creator and programmer
    http://www.developer-online.com

    Heya Waleed,
    I use spry to create an autocomplete form that works great across browsers that have javascript enabled. You can store info in a database and parse the info to xml for a dynamic approach. Take a look at the filter examples in spry.
    http://labs.adobe.com/technologies/spry/samples/data_region/NonDestructiveFilterSample.htm l
    http://labs.adobe.com/technologies/spry/samples/data_region/ZuggestSample.html

  • Using stored packages in report triggers

    Hi,
    -- Among other things, my stored packages "per7x" is
    -- capable of creating a rather complex cross-table.
    -- A particular function returns this as a pl/sql table
    -- of integers (index by binary_integer).
    -- Another sub-program of the package creates a persistent
    -- pl/sql table representing the cross-table. This is the
    -- procedure "init_main" that has some parameters with
    -- default values. The function "get_main_value" returns
    -- a particular row/column value. (Of course, the table
    -- persists only for the duration of the database session.
    -- The following code runs fine from SQL*Plus
    -- (per7x.init_main takes a few seconds to complete, then,
    -- the next statement delivers the expected result):
    set serveroutput on;
    begin
    per7x.init_main;
    dbms_output.put_line(per7x.get_main_value(1,1));
    end;
    -- But now for some serious business. I want to retrieve
    -- these values from within a Developer/2000 Reports
    -- application. I figured calling "per7x.init_main" at
    -- the BeforeReport trigger and I would call
    -- "per7x.get_main_value" at the FormatTrigger level.
    -- But... calling the initialization procedure, as in:
    function BeforeReport return boolean is
    begin
    per7x.init_main;
    return (TRUE);
    end;
    -- results in:
    -- R30DES32 caused an invalid page fault in
    -- module PLS234.DLL at 0137:0050827c.
    -- and Reports will be shut down.
    -- the message:
    -- REP-1401: 'beforereport'. Fatal PL/SQL error occured.
    -- occurs when attempting to make a local copy of the
    -- pl/sql table instead of using the persistent structure.
    -- What goes wrong here??
    -- I am connected to: Oracle Workgroup Server 7.3.2.3.1
    -- with the Distributed Option, PL/SQL version 2.3.2.3.0
    -- (Windows NT 4.0)
    -- I use Developer/2000 version 2.0 (Reports 3.0.4.6.3)
    -- on Windows 95,
    -- SQL-Plus is version 3.3.4.0.0
    Any help would be very much appreciated,
    Paul Ramsteijn,
    Renal Replacement Registry of the Netherlands (RENINE).
    E-mail: [email protected]
    null

    hi,
    i'm back.. :)
    i attempted to use the following pl/sql code in a pl/sql process.
    begin
      for i in 1..apex_application.g_f01.count
      loop
        apc_user_pkg.update_user_role ( p_user_role_id     => apex_application.g_f02(i)
                                       ,p_start_on         => apex_application.g_f05(i)
                                       ,p_end_on           => apex_application.g_f06(i)
                                       ,x_last_updated_on  => apex_application.g_f09(i)
                                       ,x_last_updated_by  => apex_application.g_f10(i) );
      end loop;
    end;however, it doesn't seem to be working properly.. it doesn't update the table.. after the page refreshes, the old data comes back and not the new one.
    what am i doing wrong?
    regards,
    allen

  • How to use Salary packaging in ESS...?

    Hi All,
    We are using ESS 1.0, Webdynpro 600 (EP 7.0).
    Is there any standard service for Salary packaging compare (employee perspective) to re-structure his salary components ?
    I found tcode : P16B in ECC 6.0.
    But I donno how to use and customize it. Please shade some light regarding the same...... what are prerequisites for this tcode ?
    Looking forward to your responses. Appreciate your help in advance. Usefull answers would be rewarded full points.
    Regards,
    Anil Kumar

    Hi Sakti,
    We are using India Country Grouping - 40.
    When I enter the tcode - p16b from end user;s logon, it says transaction cannot be performed.
    Please let me know your inputs for the same.
    Regards,
    Anil Kumar

Maybe you are looking for