APEX: Use the SQL query in the APEX_MAIL package

Hi all
I'm creating an application in which I want to extract records from table and send it to the user. Please help me on this.

Thank you
Martin

Hello I am,.

You can see the code below.
DECLARE
l_body_html CLOB.
l_body CLOB.
BEGIN
l_body: = 'Hello Daniel. "

l_body_html: = '

';

C1 in (select distinct (act_name), act_desc, act_steps, reboot_date servername HWC_CHK_SCHEDUELE where chk_name =: P2_SELECT_CHECKLIST and reboot_date =: P2_REBOOT_DATE)
loop

l_body_html: = l_body_html | '

' || '' || '' || '' || '';

end loop;

l_body_html: = l_body_html | '

Name of the lawLaw on ESCRMeasures ActName of the serverRestart Date
' || C1.act_name | '' || C1.act_desc | '' || C1.act_steps | '' || C1. SERVER_NAME. '' || C1.reboot_date | '
';
l_body_html: = l_body_html | '
' || "Thanks & Regards | '
';
l_body_html: = l_body_html | "Patel Dr.Jiten";

() apex_mail. Send
p_to =>: P2_EMAIL,
P_FROM-online "[email protected]."
p_body-online l_body,
p_body_html-online l_body_html,
p_subj => "You must work on ABC named Checklist");
END;

Tags: Database

Similar Questions

  • How to know the status of the process flow using a SQL query

    Hello
    I want to know the final status of a process flow after execution by using a sql query?

    The available entries are:
    -Item_Key
    -Process_Flow_Package_Name
    -Process_Flow_Name

    I ran the process flow using a WF_Engine.LaunchProcess ()procedure, but I was not able to know the status of the process flow.


    Is it possible to know the status of the process flow?

    using a procedure or an sql query?

    Thanks in advance,
    SriGP.

    Once the process is completed, or not, you can see the status by calling:

    UAS (your_OWF_shema) .wf_engine. ItemStatus()

  • Email scripts do not when using the UTL_TCP package

    Hi all

    I wrote a script to email using the UTL_TCP package.

    create or replace procedure pr_email (p_email_from in varchar2,
    p_email_to in varchar2,
    p_email_cc in varchar2,
    p_email_subject in varchar2,
    p_email_text in varchar2
    *) is *.

    l_conn utl_tcp.connection;

    l_result pls_integer;
    l_localhost varchar2 (100): = ' ora - drs.dryers.com';

    Start
    dbms_output.put_line ('Start: execution of ' |) "PR_EMAIL");
    l_conn: = utl_tcp.open_connection (l_localhost, 1523);
    dbms_output.put_line ('open Connection');
    l_result: = utl_tcp.write_line (l_conn, 'DRS HELO');
    dbms_output.put_line ('The L_RESULT' | l_result);

    dbms_output.put_line (' checking the connection ' |) UTL_TCP.get_line (l_conn, true, true)); _ + / * mkk * / *

    l_result: = utl_tcp.write_line (l_conn, l_localhost);
    l_result: = utl_tcp.write_line (l_conn, ' MAIL FROM: ' | ') p_email_from);
    l_result: = utl_tcp.write_line (l_conn, ' RCPT TO: ' | ') p_email_to);

    l_result: = utl_tcp.write_line (l_conn, ' RCPT TO: ' | ') p_email_cc);
    dbms_output.put_line ('The L_RESULT' | l_result);
    l_result: = utl_tcp.write_line (l_conn, 'DATA');
    l_result: = utl_tcp.write_line (l_conn,
    *'Date: ' | *
    TO_CHAR (sysdate, ' dd my yy hh24:mi:ss'));)
    l_result: = utl_tcp.write_line (l_conn,
    *' De : ' || p_email_from | ' <' || *
    p_email_from | ') ;
    l_result: = utl_tcp.write_line (l_conn, "MIME-Version: 1.0 '");
    l_result: = utl_tcp.write_line (l_conn,
    *'To: ' || p_email_to | ' <' || *
    p_email_to | ') ;

    --*
    l_result: = utl_tcp.write_line (l_conn,
    *'Cc: ' || p_email_cc | ' <' || *
    p_email_cc | ') ;
    --*
    l_result: = utl_tcp.write_line (l_conn, ' subject: ' | p_email_subject);
    l_result: = utl_tcp.write_line (l_conn, ' Content-Type: text/plain "");
    l_result: = utl_tcp.write_line(l_conn, '');
    l_result: = utl_tcp.write_line (l_conn, p_email_text);
    l_result: = utl_tcp.write_line(l_conn, '');
    l_result: = utl_tcp.write_line(l_conn, '');
    l_result: = utl_tcp.write_line (l_conn, '.');
    l_result: = utl_tcp.write_line (l_conn, 'QUIT');
    UTL_TCP.close_connection (l_conn);
    dbms_output.put_line ("' closed connection");

    dbms_output.put_line ('End: execution of ' |) "PR_EMAIL");

    end pr_email;


    When I'm the enforcement procedure
    pr_email exec ('[email protected]', '[email protected]', '[email protected]', 'Test', 'Test');
    It's a failure to comment . MKK.

    I get an error message:
    ORA-29259: end-of-input reached
    ORA-06512: at "SYS." UTL_TCP", line 127
    ORA-06512: at "SYS." UTL_TCP", line 321
    ORA-06512: at "SYS." UTL_TCP", line 391
    ORA-06512: at "DRS_MGR. PR_EMAIL", line 20
    ORA-06512: at line 1


    When I comment the code dbms_output.put_line (' checking the connection ' |) UTL_TCP.get_line (l_conn, true, true)); + / * mkk * / _
    and run the procedure, I get no error, but I do not receive the mail.

    FOR INFO:
    The hostname and PortNumber I got from our Listner.ora file to our database.


    Let me know I do everything wrong here.

    Appreciate your help.

    Thank you
    Madhu K.

    UTL_MAIL is the new package to send mail from PL/SQL. UTL_SMTP was the package to do before 10.1.

    Normally, you would ask the administrator of the mail server if they are really running the SMTP server on a very unusual port on that server. Except that you can manually telnet to the server specified on the specified port, type "HELO" and see what was the answer. If there's nothing listening on the port, the telnet session fails. If there is an SMTP server listens on this port, it must respond to the HELO command.

    Justin

  • Can I add watermarks to PDF files using the PDF package?

    Can I add watermarks to PDF files using the PDF package?

    Hi Susannah,

    Adobe PDF Pack does not allow to edit a PDF file. To do this, you would need Acrobat. We invite you to try Acrobat free for 30 days: see http://www.adobe.com/products/acrobat.html for more information.

    This help document describes how to watermark a PDF in Acrobat: add watermarks to PDF

    Best,

    Sara

  • Can we use the same package for main and begotten of concurrent programs.

    Hello

    I use a package.procedure1 for a simultaneous program. Can I use the same package.procedure2 of a pondu simultaneous program which was called from package.procedure1? If I say incompatible as the same program of 1, which will create problems by running the 2nd program because the package is same?

    Thank you
    HC

    I use a package.procedure1 for a simultaneous program. Can I use the same package.procedure2 of a pondu simultaneous program which was called from package.procedure1?

    Yes you can.

    If I say incompatible as the same program of 1, which will create problems by running the 2nd program because the package is same?

    When you second the 2nd program it will not work if the 1st program execution, and he has to wait until you have completed the 1st program.

    Don't know what code you use in the first and second procedures or even in the whole, but you can try this in a TEST instance first and check whether or not it works as expected.

    Thank you
    Hussein

  • Cannot see data in excel after using the export_excel package

    After using the export_excel package of some cells in the display worksheet "#". If the cell is selected displays the data, but it disappears when you exit the cell and try to print it. Anyone know what causes this problem?

    Thank you

    Hello

    From the following link, the maximum width of a column in Excel 2000 is 255 characters: http://support.microsoft.com/kb/264626

    So, it seems that you may need to be upgraded, divide the cell into 2 or more cells, or add in a few line breaks?

    Andy

  • Application of interactive report of apEx using the last value of the point

    My interactive report is based on a field, but the value of the field is not applied when executing the query

    SELECT *.

    MyTable FROM A

    where A.registration_year =: REGISTRATION_YEAR_ITEM

    I created an item in the page REGISTRATION_YEAR_ITEM

    When I run the query, I want the user to type in a year, and then run the query and display the corresponding results.

    The query always seems to use the default value of points instead of the current value

    How can I do use the value of the current field?

    I also tried the V method, but produce the same results

    where A.registration_year = v('REGISTRATION_YEAR_ITEM')


    The environment is ApEx 312, 10.2.0.4 database

    Unfortunately, the upgrade is not an option


    Thanks for any help you can offer

    S.Bovin wrote:

    My interactive report is based on a field, but the value of the field is not applied when executing the query

    SELECT *.

    MyTable FROM A

    where A.registration_year =: REGISTRATION_YEAR_ITEM

    I created an item in the page REGISTRATION_YEAR_ITEM

    When I run the query, I want the user to type in a year, and then run the query and display the corresponding results.

    The query always seems to use the default value of points instead of the current value

    How can I do use the value of the current field?

    Add the REGISTRATION_YEAR_ITEM to the IR Page elements to submit property. He will submit the current value in session state.

    Why bother with the page element at all? Why users can't create just an IR filter?

    I also tried the V method, but produce the same results

    where A.registration_year = v('REGISTRATION_YEAR_ITEM')

    For performance reasons, use bind variable notation when you reference values from session state in SQL queries.

    The environment is ApEx 312, 10.2.0.4 database

    Unfortunately, the upgrade is not an option

    Why not? That it will provide you with a safe and supported environment and your users with a much better life.

  • Does anyone know where / why APEX uses the CLIENT_IDENTIFIER internally?

    I am trying to share a global CONTEXT, but I can't get this through sys_context (...), if I change the CLIENT_IDENTIFIER or clear it with: dbms_session.clear_identifier () in the APEX;

    The CLIENT_IDENTIFIER is defined by the APEX for each cycle DISPLAY-SUBMIT to "< APEX_USER >: < SESSION_ID >.

    I can't change, but I guess that there is a purpose behind it. Nobody knows, and doing a risk during erasing it in my code? ... of the problems elsewhere

    Thank you very much
    -Thomas

    Hello

    Apex sets the CLIENT_INDENTIFIER so that it does not exist in the dynamic view V$ SESSION and you know what Apex user/session, the database session is processing. Apex also defines the ACTION and the MODULE so that you know who asked the apex and the page treats the database session.

    Rod West

  • use a SQL query in a backing bean

    Hello

    I would like to know how to run an SQL query in a method of bean to support, what is the code I tried, its purpose is to fill in the field "cin" with data from my database, here is the Code:

    public String cb2_action() {}
    BindingContainer links = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding ("CreateInsert");
    Object result = operationBinding.execute ();
    If (! operationBinding.getErrors () .isEmpty ()) {}
    Returns a null value.
    }
    DCIteratorBinding dciter = (DCIteratorBinding) bindings.get ("PersonneView1Iterator");
    Line row = dciter.getCurrentRow ();
    Statement stmt = this.getDBTransaction () .createStatement (1);
    try {}
    ResultSet rs = stmt.executeQuery ("select max (cin) person");

    While {(rs.next ())}

    row.setAttribute ("cin", rs.getInt (1) + 1);
    }
    } catch (SQLException ex) {}
    ex.printStackTrace ();
    }
    return 'go. '
    }

    at runtime, it gives an error on this line: statement stmt = this.getDBTransaction () .createStatement (1);

    Please check and correct me

    Thanks in advance

    Hello

    Initially, I want to say that this should not be used if you try to get a PrimaryKey that would create serious concurrency problems.

    For example, lets say you want when you create a new employee to define its equal to the max Department DepartmentId.

    We could create a readOnly VO (lets call it MaxDepartmentId) with a query that returns the departmentId max:

    select max(Department_Id) as maxDep from Departments
    

    After that, he must add the VO of MaxDepartmentId as a ViewAccessor in our Vo employees,
    Override the create() method in the EmployeesRowImpl and add the code like this:

    public class EmployeesRowImpl extends ViewRowImpl {
        @Override
        protected void create(AttributeList attributeList) {
            Row r=getMaxDepartmentId().first();
            if(r!=null){
                 Number max=(Number)r.getAttribute("Maxdep");
                 attributeList.setAttribute("DepartmentId", max);
            }
            super.create(attributeList);
        }
    }
    

    That's all.
    If you run this, you'll see that when you create a new employee, it has a default value.

    Gabriel.

  • How to use the DBMS_ROWID package

    Hello

    I am not able to use this DBMS_ROWID package, I ran this script in my schema dbmsrwid.sql

    When I use this sql I get the following error:

    SQL > select DBMS_ROWID. ROWID_BLOCK_NUMBER (ROWID)
    2 FROM emp3
    3 where id = 1;
    Select DBMS_ROWID. ROWID_BLOCK_NUMBER (ROWID)
    *
    ERROR on line 1:
    ORA-04067: not executed, the package body "KAM. DBMS_ROWID' does not exist
    ORA-06508: PL/SQL: called program unit is not found: "KAM. DBMS_ROWID.
    ORA-06512: at line 1

    and also when I try to use below that I get the same above erro

    SQL > DBMS_ROWID. () ROWID_BLOCK_NUMBER

    If I connect with scott so I am able to do it as below:

    SQL > select DBMS_ROWID. ROWID_BLOCK_NUMBER (ROWID)
    2 FROM emp
    3. WHERE ename = 'KING '.

    DBMS_ROWID. ROWID_BLOCK_NUMBER (ROWID)
    ------------------------------------
    30
    Thank you and best regards,
    Kam

    Did you run dbmsrwid.sql in the KAM schema? Because it seems that the DBMS_ROWID package has been created it there.

    I suggest you drop the package in the KAM schema version, unless there is a specific reason that you need (very, very unlikely that you do).

    DROP PACKAGE kam.dbms_rowid
    

    If you do this, the SELECT statement that has worked in the SCOTT schema should also work in the KAM schema.

    SQL > SYS. DBMS_ROWID. () ROWID_BLOCK_NUMBER
    SP2-0734: unknown command starts 'SYS. DBMS_R... "- rest of line is ignored.

    You cannot call a function like this just to the SQL * quicker. You need to put it in a SELECT statement. If you add the SYS prefix to the query that you previously had, it should work as well. But if you do not file the package, you will always have an invalid version of DBMS_ROWID in the KAM schema.

    Justin

  • Steps using the DBMS_PROFILER package.

    Hi all

    I'd like to collect statistics for my stored procedure using DBMS_PROFILER package, but when I run the package by using the sample below, I get the following errors. I read the Oracle documentation, you need to have some loaded scripts (PROFTAB.sql.) etc. to execute it.

    Could someone, please give me the exact measurements that are necessary, if I can use this package in my diagram. Not as with which the user scripts should be executed, if scripts must be run in my schema, or etc., to grant all privileges and so on.

    Thank you.

    Below is executed the sample and the error I get. I use the version of Oracle 11 g.

    Samples:

    BEGIN

    DBMS_PROFILER.start_profiler ('test_profile');

    test;

    DBMS_PROFILER.stop_profiler;

    END;

    Error report-

    ORA-06528: PL/SQL Profiler generator runtime error

    ORA-06512: at "SYS." DBMS_PROFILER", line 123

    ORA-06512: at "SYS." DBMS_PROFILER", line 132

    ORA-06512: at line 2

    06528 00000 - "PL/SQL runtime error profile.

    * Cause: An error occurred during the execution of a PL/SQL Profiler

    operating mode.

    ORACLE-BASE - Oracle9i DBMS_PROFILER

    See you soon,.

    Manik.

  • After replacing the motherboard of PC how can use the license package, is the same hard drive.

    Mr President, our pc is repaired & change the motherboard and now how to use the product under license of photoshop

    It could be cleaner if you uninstall the products in question, using the CS cleanup tool and then contact Adobe technical support via chat and ask to reset your activations before install and activate the software again.

    Adobe Creative Suite cleanup tool

    helps resolve installation for CS3 thru CS6 and creative cloud problems

    http://www.Adobe.com/support/contact/cscleanertool.html

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat

    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

    Before you uninstall, you can see if you can extract the serial number in case you don't have it at hand.

    If it's a Windows machine, and then try running Belarc Advisor

    http://www.Belarc.com/free_download.html

    For a Mac, you can try:

    https://Mac-product-key-Finder.com/

  • ID of PK through the report apex using the URL and screen modal popup open

    Hello my dear,

    I use apex 4.2.0.00.27

    I am facing a little problem and I hope that you guys will help me please?

    I have 3 regions. 1 first is view only then 2nd region's interactive report and a 3rd has only 1 column.

    in the report of the region say select id, ename, empno, sal, ' ' edit_link columns for example. region 2 static id is 'Create_Reason'.

    I created DA using code JavaScript as (javascript:openModal('Create_Reason');) for modal and made page region (region 3) so is it opens as a page modal popup.

    I added a url (javascript:openModal('Create_Reason'_) ;) as chosen target is the URL in report item (edit_link).)

    It will open a modal pop-up window average area 3 on the same page and I'm doing what I want to do, but I don't get PK id in session state, so I can't update my chosen rank.

    Because PK ID is not in session state, so I can't use condition where clause and it is not updated my application.

    Any help please?

    Very much appreciated.

    Kind regards

    RI

    I realized it. in fact, I changed the report item (edit_link).  In (link in the column, link attrribute #ID # and the target page in the app and the page # (item1 (hidden) p1_item1 question on the page) and value (#ID #).)

    then I created DA as the loading of the page and run the code JS as javascript:openModal('Create_Reason'); and service area to be displayed and the item added a condition (p_item1 (hidden_item is not null).)

    before has worked, but only he send the page or refresh the screen and load the popup.

    Is anyone has the best solution or higher is good?

    Thank you.

    RI

  • Slow query using the SDO_GEOM package

    Hello
    I have a query that retrieves data from a table:

    SDO_GEOM.sdo_centroid (geometry, 0.5).sdo_point.x

    It's very, very slow, but about 15 seconds to 300 cases.
    Delete this package to select, it's very fast.

    Ideas for how tuning package spacial?

    TNX

    you better to activate extended SQL trace (tkprof utility) and paste the result, if the experts are around here if your chance favor, then you can get some clues.

    Khurram

  • Routing of URL of application APEX using the HTTP Server

    Hello

    I want to route two URLS for two different applications in one single APEX.

    for example

    www.mydomain1.com to http://www.mydomain.com/apex/f?p=100 | http://xxx.xxx.xxx.xxx/Apex/f?p=100

    www.mydomain2.com to http://www.mydomain.com/apex/f?p=200 | http://xxx.xxx.xxx.xxx/Apex/f?p=200


    I understand the way to achieve this is second-hand HTTP server... it's very well... it was built and works with standard http.conf

    My understanding is that I should add the following to HTTP. CONF

    < VirtualHost www.mydomain1.com >
    ServerName www.mydomain1.com
    DocumentRoot "G:/route1.
    < / VirtualHost >

    < irtualHost www.mydomain2.com >
    ServerName www.mydomain2.com
    DocumentRoot "G:/route2".
    < VirtualHost >

    G:/route1 directory I created a HTML index www.mydomain1.com/apex/f?p=100 redirection file
    G:/route2 directory I created a HTML index www.mydomain1.com/apex/f?p=200 redirection file


    That I put in place and it works

    BUT

    I do not look very elegant, time which is a bit slower while he rediects and some firewalls do not rediections

    Ideas of improvements or the best way to achieve this is welcome

    Thank you

    Pete

    Hi Pete,.

    A few different ways to do it, but if you use mod_rewrite, you can use some rewrite rules, for example:

    
    ServerName www.mydomain1.com
    ServerAlias www.mydomain1.com
    
    ProxyPreserveHost On
    RewriteEngine On
    
    RewriteRule ^/$ /pls/apex/f?p=100 [R=301,L]
    
    

    Or if you are using a reverse proxy:

    
    ServerName www.mydomain1.com
    ServerAlias www.mydomain1.com
    
    ProxyPreserveHost On
    RewriteEngine On
    
    RewriteRule ^/$ /pls/apex/f?p=100 [R=301,L]
    
    ProxyPass /pls/apex http://foo:7777/pls/apex
    ProxyPassReverse /pls/apex http://foo:7777/pls/apex
    ProxyPass /i http://foo:7777/i
    ProxyPassReverse /i http://foo:7777/i
    
    

    Hope this helps,

    John.

Maybe you are looking for

  • EliteBook 9470 m: silent speaker won't turn on orange

    I know that this is a trivial question, but bothers me so this is: I had to reinstall Win7 on my laptop. There are two buttons lit in the corner at the top right of the keyboard: one for staff and one for audio. The wifi button turns orange when I tu

  • Photosmart C410b installation on Windows 8.1

    Hello I have a Photosmat C410b printer and have a Microsoft Surface with Windows 8.1Pro Prieview. The HP PS_AIO_07_C410_140_408.exe software was used to connect to the network printer. After the installation of the printer was working without any pro

  • Nicht mehr audio works

    Wenn ich den Lautsprecher aktivieren möchte, says mir das System "Sindh are keine Audiogerate installed" At ist und wie kann ich den Fehler beheben faul? Danke fur schnelle Hilfe!

  • R510 failure [CF]

    Buongiorno, sul nostro Power Edge R510 (serial number C3YGW4J) e comparsa una written di hard disk absent. Guardando it Server Manager if vede che è una anomalía sulla scheda raid Perc H700 integrata della batteria e che è a failed drive. Reed is sem

  • Image of ios LWAPP

    Hello which is image ios LWAPP for cisco 1242AG AP series? C1240-k9w7 - tar.124 - 10B .JA .tar C1240-k9w7 - tar.124 - 10B .JA3 .tar C1240-k9w7 - tar.124 - 25d.JA.tar