Insert date sent in flag email script

I need to insert the date sent into this flagged email script to make it more useful, just not sure how to do it:
set newline to ASCII character 12
set finalText to "EMAIL REMINDERS:" & newline
tell application "Mail"
          set theMessages to every message in inbox whose flagged status is true
          repeat with i from 1 to number of items in theMessages
                    set thisMessage to item i of theMessages
                    set fromMsg to (sender of thisMessage as string)
                    set subjMsg to (subject of thisMessage as string)
                    set finalText to finalText & "FLAG: " & word 1 of fromMsg & " : " & subjMsg & " : " & newline
          end repeat
end tell
finalText

Hi,
The E-mail template is actually works as an HTML or CSS page. You need to use the HTML/CSS formats to send these values in the format as you want. Use <tags> to do the formating of Email template. 
Use function to store multiple values and thn use them into Email 
I hope this will help. 
Thanks~ Giriraj Singh Bhamu

Similar Messages

  • How to insert data from file into matlab script node

    I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • Form data sent to email in a table. (How do I?)

    What I am trying to do is take the data input from a form, and have that data sent via email within a table.
    Example:
    Header 1
    Header 2
    Name:
    John Doe
    Email:
    [email protected]
    Company:
    johns plumbing
    Phone:
    555-555-5555
    Comment:
    This is my comment
    Right now it sends the email fine, but it is in plain text (UGLY)
    Here is my PHP (ignore the check boxes they are going to be replaced with text fields that will go into the table):
              Please correct the following error:

    Remove this patch of code:
    $message = "$company has submitted a problem via Problem Ticket Form.
    Name: $name
    E-mail: $email
    Company: $company
    Phone Number: $phone
    I am having issues in the following areas:
    $problem1
    $problem2
    $problem3
    $problem4
    Comments:
    $comment
    End of message
    Use PHP to create a table within your message body:
        $message = '<table border="1">';
        $message .= '<tr>';
        $message .= '<td>E-mail :</td><td>'.$email.'</td>';
        $message .= '</tr><tr>';
        $message .= '<td>Company :</td><td>'.$company.'</td>';
        $message .= '</tr>';
        $message .= '</table>';
    The above script will capture Email & Company. But you should get the idea. Add all the desired fields within here by creating new <tr> rows/ columns.
    And your existing script will do the rest of mailing this out as a 'table'.

  • Javascript to extract data to be sent to an email

    Does anyone know how to extract the data from a form to be sent to an email address using JavaScript?
    The reason for doing this is because Acrobat does not handle using a web mail client to send data very well (the user would have to save the form, and attach it to their email). I'm looking for more of a streamline solution. If your email client is Outlook, Outlook Express, or some other PC based email client, then Acrobat handles that situation perfectly.
    Thank you in advance for any help.
    -Shane

    Do you mean send an e-mail without interacting with any local e-mail client, as in having its own SMTP server built-in? No, Acrobat does not do that. You need a local e-mail client in order to use the e-mail functionality. If you're concerned about the Gmail Generation, I suggest you use a SOAP webservice instead of e-mail.

  • Can any one tell how to modify the PO that is being sent as an email?

    Hi,
           Can anyone let me know that how to modify the PO with some more additonal data while being sent as an email.
    My actual requirement is that PO is already being sent as an email when the PO is created.But now they want some more additional data as an attachement along with PO to be sent as email.ie both PO and another scriptform(which contains some other additonal data other than from PO) have to be sent as an email to the vendor when the PO is created.
    I would like to know the name of the userexit,where I can modify the existing PO or else please let me know how to resolve this issue.
    First of all I would like to know the name of the userexit where this PO is being sent as an email.
    It doesn't matter whatever the solution might be.But we need to send another sapscript form or additional data as an attachement along with PO through email to the vendor.I dont know whether it should be another script or it is also ok to add that data to the existing PO and then only the PO can be sent.
    Thanks,
    Krishna

    Eswar,
                Thanks for your email.Can you please be bit clear.I am new to this area.
    Any flexible solution is ok for me.Is it in the Userexit,that I need to include the code or what are outtypes as you said.
    Please give me clear solution.
    Thanks,
    Krishna

  • How to work with flags in scripts

    Hi all,
    I'm trying to automate the process of evaluating data in Diadem View using flags. So far I can set the flags through script commands (chnflagset) , but after that I need to change to interactive mode to replace the flagged data by NoValues (Flags: Remove data points). Is there a way to call this command from within my script so that I don't need the user interaction?
    Thanks,
    Marcel
    Solved!
    Go to Solution.

    Hi Marcel,
    I see, and now I fully understand what you're doing and why you need to automate flags and flag actions.  The functions to set and delete flags are documented, but we do not have any documented functions to fit, delete, or copy the flagged points.  These functions do exist, and are called when you interactively press the VIEW buttons.  There is a way to call them, but since it is not documented, that means that code you write today might not work in a later DIAdem version.  However, I do have code that works up to the latest version of DIAdem now available, 11.1 Beta1.  Feel free to email me at [email protected] to request these commands.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • RFC scenario for inserting data in SAP, help me experts

    hi...
    i have to insert data in SAP database using BAPI_PR_CREATE.
    which adapter i hv to use for RFC(sender/receiver)(syn/Asyn).
    this sceanrio is File1-RFC-File2.
    file1 sends the data to RFC to insert data and file2 should hv to send the autogeneration keyID for PR
    Its very urgent...
    please help me..
    thx in advance
    john

    hi ...
    i did that..
    but..iam gting only 1 msg in monitering...
    evrythn is fine,,,,my scenario shows in MONI black flag...but gting only one msg and the data which i sent to SAP is not storing in SAP..and when i search in SM58 in XI server...i cnt see any messages...
    can u explain me Y..?
    thx for response..
    john

  • Emailing scripts & forms

    hi frnds
    can anybody tell me how to email script and forms.
    well for emailing we have to download the script to pdf file how to do that .has anybody used rstxpdft4 progrm. we have to give the spool request no for downloading into pdf file .  but i dont know how to generate the spool request no.

    Hai Rohit Gupta
    Check the following COde
    REPORT ZRICH_0003.
    DATA: ITCPO LIKE ITCPO,
          TAB_LINES LIKE SY-TABIX.
    Variables for EMAIL functionality
    DATA: MAILDATA   LIKE SODOCCHGI1.
    DATA: MAILPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: MAILHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: MAILBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILREC    LIKE SOMLREC90 OCCURS 0  WITH HEADER LINE.
    DATA: SOLISTI1   LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    PERFORM SEND_FORM_VIA_EMAIL.
          FORM  SEND_FORM_VIA_EMAIL                                      *
    FORM  SEND_FORM_VIA_EMAIL.
      CLEAR:    MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
      REFRESH:  MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
    Creation of the document to be sent File Name
      MAILDATA-OBJ_NAME = 'TEST'.
    Mail Subject
      MAILDATA-OBJ_DESCR = 'Subject'.
    Mail Contents
      MAILTXT-LINE = 'Here is your file'.
      APPEND MAILTXT.
    Prepare Packing List
      PERFORM PREPARE_PACKING_LIST.
    Set recipient - email address here!!!
      MAILREC-RECEIVER = '[email protected]'.
      MAILREC-REC_TYPE  = 'U'.
      APPEND MAILREC.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = MAILDATA
                PUT_IN_OUTBOX              = ' '
           TABLES
                PACKING_LIST               = MAILPACK
                OBJECT_HEADER              = MAILHEAD
                CONTENTS_BIN               = MAILBIN
                CONTENTS_TXT               = MAILTXT
                RECEIVERS                  = MAILREC
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
    ENDFORM.
         Form  PREPARE_PACKING_LIST
    FORM PREPARE_PACKING_LIST.
      CLEAR:    MAILPACK, MAILBIN, MAILHEAD.
      REFRESH:  MAILPACK, MAILBIN, MAILHEAD.
      DESCRIBE TABLE MAILTXT LINES TAB_LINES.
      READ TABLE MAILTXT INDEX TAB_LINES.
      MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
    Creation of the entry for the compressed document
      CLEAR MAILPACK-TRANSF_BIN.
      MAILPACK-HEAD_START = 1.
      MAILPACK-HEAD_NUM = 0.
      MAILPACK-BODY_START = 1.
      MAILPACK-BODY_NUM = TAB_LINES.
      MAILPACK-DOC_TYPE = 'RAW'.
      APPEND MAILPACK.
    Creation of the document attachment
    This form gets the OTF code from the SAPscript form.
    If you already have your OTF code, I believe that you may
    be able to skip this form.  just do the following code, looping thru
    your SOLISTI1 and updating MAILBIN.
      PERFORM GET_OTF_CODE.
      LOOP AT SOLISTI1.
        MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
        APPEND MAILBIN.
      ENDLOOP.
      DESCRIBE TABLE MAILBIN LINES TAB_LINES.
      MAILHEAD = 'TEST.OTF'.
      APPEND MAILHEAD.
    Creation of the entry for the compressed attachment
      MAILPACK-TRANSF_BIN = 'X'.
      MAILPACK-HEAD_START = 1.
      MAILPACK-HEAD_NUM = 1.
      MAILPACK-BODY_START = 1.
      MAILPACK-BODY_NUM = TAB_LINES.
      MAILPACK-DOC_TYPE = 'OTF'.
      MAILPACK-OBJ_NAME = 'TEST'.
      MAILPACK-OBJ_DESCR = 'Subject'.
      MAILPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND MAILPACK.
    ENDFORM.
         Form  GET_OTF_CODE
    FORM  GET_OTF_CODE.
      DATA: BEGIN OF OTF OCCURS 0.
              INCLUDE STRUCTURE ITCOO .
      DATA: END OF OTF.
      DATA: ITCPO LIKE ITCPO.
      DATA: ITCPP LIKE ITCPP.
      CLEAR ITCPO.
      ITCPO-TDGETOTF = 'X'.
    Start writing OTF code
      CALL FUNCTION 'OPEN_FORM'
           EXPORTING
                FORM     = 'ZTEST_FORM'
                LANGUAGE = SY-LANGU
                OPTIONS  = ITCPO
                DIALOG   = ' '
           EXCEPTIONS
                OTHERS   = 1.
      CALL FUNCTION 'START_FORM'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
      CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                WINDOW        = 'MAIN'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
    Close up Form and get OTF code
      CALL FUNCTION 'END_FORM'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
      MOVE-CORRESPONDING ITCPO TO ITCPP.
      CALL FUNCTION 'CLOSE_FORM'
           IMPORTING
                RESULT  = ITCPP
           TABLES
                OTFDATA = OTF
           EXCEPTIONS
                OTHERS  = 1.
    Move OTF code to structure SOLI form email
      CLEAR SOLISTI1. REFRESH SOLISTI1.
      LOOP AT OTF.
        SOLISTI1-LINE = OTF.
        APPEND SOLISTI1.
      ENDLOOP.
    ENDFORM.
    Thanks & regards
    Sreenivasulu P

  • Using variables to insert data in the table

    I want to insert datas in the table. I use constants,
    all the constants are stored properly in the table. But,
    when I use variables I get the error message
    "Too few parameters. expected 6".
    (I declared all the fields of the table as text only.)
    My program is "newt.jsp"
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <head>
    <title>storing customer information in the database</title>
    </head>
    <body>
    <%
    String cno1 = request.getParameter("cno");
    String n1 = request.getParameter("n");
    String add11 = request.getParameter("add1");
    String add21 = request.getParameter("add2");
    String phone1 = request.getParameter("phone");
    String email1 = request.getParameter("email");
    Connection con = null;
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:customer"," "," ");
    Statement statement1 = con.createStatement();
    Statement statement2 = con.createStatement();
    statement2.executeUpdate("create table cust1 (cno varchar(20),n varchar(20),add1 varchar(20),add2 varchar(20),phone varchar(20),email varchar(20))");
    statement1.executeUpdate("insert into cust1 (cno,n,add1,add2,phone,email) values(cno1,n1,add11,add21,phone1,email1)");
    catch(SQLException sqle) {
    System.err.println(sqle.getMessage());
    catch(ClassNotFoundException cnfe) {
    System.err.println(cnfe.getMessage());
    catch(Exception e) {
    System.err.println(e.getMessage());
    finally {
         try {
         if(con!=null) {
              con.close();
    catch(SQLException sqle) {
    System.err.println(sqle.getMessage());
    %>
    <br><br>
    Mr./Ms. <%=n1 %> <br>
    Your datas have been stored.<br>
    </body>
    </html>
    Those who know answer please reply.
    My thanks in advance.

    I would expect your insert statement to be this:
    statement1.executeUpdate("insert into cust1 (cno,n,add1,add2,phone,email) values('"+cno1+"','"+n1+"','"+add11+"','"+add21+"','"+phone1+"','"+email1+"')");
    If you just create a string, it's not going to fill in variables into the string by magic.

  • How can I insert data into the standard CRM tables ?

    Hi Experts,
    Scenario----
    I need to download few attributes (fields) from SAP MDM to SAP CRM via SAP XI. I'm using the 'COMT_PRODUCT_MAINTAIN_API' API for it.
    The attributes(fields) that are present in the strucutres of API are downloaded into CRM system (by executing the Inbound proxy that is created based on the Message Interface created on XI) by calling the functions present in the API.
    And for those fields that are not present in CRM, but need to be downloaded into CRM, I'm creating the Set Type attributes in CRM, which get appended to the API.
    My query is:
    There are fields in CRM into which I need to insert the values. But they are not listed in the API. So, how can I insert(/download) the values into these standard fields?
    Regret the long description. Intended to be clear.
    TIA. Points will be awarded.
    Regards,
    Kris
    Edited by: Kris on Jul 21, 2008 8:00 AM

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • How can I Insert data into my msaccess Database table

    Hello all,
    I am new to Java programming and I have problem that how can i insert name into my database table.
    The code which i have written is following:
    String filename = "d:/test.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=true}";
    Connection con = DriverManager.getConnection(database,"","");
    String s = String.valueOf(text.getText());
    int k =10;
    Statement st = con.createStatement();
    st.execute("create table Test123(name text)");
    st.execute("INSERT INTO Test123 values" +s);
    on the INSERT program throws exception???
    can any one help me how to insert data into tabel.
    Thanks

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • How to insert data in a column with uniqueidefier data type

    Guys,
    I need insert data in a column with uniqueidefier data type, when i am trying to that getting error.
    error message says: "Conversion failed when converting from a character string to uniqueidentifier."
    I have data in table a col1,col2,col3,col4 - col3,col4 has datatype as varchar and i am updating table b columns col1,col2 with table a col3 and col4.
    Please guide how to do it.

    Hi,
    Not any String can be convert to uniqueidentifier.
    1. you have to make sure u use a value which is fir to be uniqueidentifier
    2. Use convert or cast in the insert query in order to convert the string into uniqueidentifier
    insert X ... convert(uniqueidentifier, 'string which fit to be convert to uniqueidentifier')
    Please post DDL+DML for more specific help
    DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and reproduce the problem in our server. Without DDL no one
    can execute any query.
    How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
    DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
    sample data.
    If you post a "create query" for the tables and "insert query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps
    to identify issues, clarify terminology and prevent incorrect assumptions.  Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
    [Personal Site] [Blog] [Facebook]

  • Is there a way to Insert Data into a Lookup Column Type on a SharePoint List Destination in SSIS?

    Greetings.
    I have successfully worked out inserting SQL data (2008 R2) into my 2010 SharePoint list (New, Update, Delete) by creating an SSIS Data Flow Task as outlined here:
    http://fsugeiger.blogspot.com/2010/01/synchronise-sql-table-with-sharepoint.html
    However, the problem I am running into is inserting data into the SharePoint Columns that are "Lookup" column types. I verified that all of the values I am copying from SQL into the SharePoint lookup column exist in the customn list it is pointing to. It
    is important to have this column be a lookup column as it links to another custom list that has many more columns of related information.
    I have read and re-read the SharePoint SSIS Adapters 2011.docx from
    http://sqlsrvintegrationsrv.codeplex.com/ and the only section that seems to apply is this:
    "Looking Up Values in a SharePoint List
    If you have to look up a value in a SharePoint list, you can use the Lookup transformation in your data flow, and use the SharePoint List source to load the lookup table. You may have to add a Derived Column transformation or a Script component that splits
    data in the lookup column on the ";#" delimiter to separate the ID value from the description.
    If you are replacing values in your data with the values that you look up in the list, then loading the changed data back into SharePoint, you only have to include the ID from the lookup column. SharePoint ignores the description if you include it."
    I am not sure if the above statement means that I should be passing the assocaited ID's other than the actual data into the SharePoint List destination. If that is the case, that will not really work as the lookup contains hundreds of rows. Not too mention
    I have several of these lookup column types pointing to several different lists.
    Any guidance in how I can put data into a SharePoint Lookup column type via Data Flow Task would be so much appreaciated.
    Thank you.
    My errors are:
    Error: 0x0 at Data Flow Task, SharePoint List Destination: Error on row ID="1": 0x1 - Unspecified error, such as too many items being updated at once (batch), or an invalid core field value.
    Error: 0xC0047062 at Data Flow Task, SharePoint List Destination [1903]: Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.PipelineProcessException: Errors detected in this component - see SSIS Errors at Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListDestination.ProcessInput(Int32
    inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)
    Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "SharePoint List Destination" (1903) failed with error code 0x80131500 while processing input "Component Input" (1912). The identified
    component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will

    I have found a solution to my problem and thought I would share it here in case there are others who are struggling with the above scenario. If you have a better way, I would love to hear about it since my way is a bit tedious.
    In a nutshell, in order to have an SSIS package put data from an OLE DB Source into a SharePoint List Destination Lookup Column, you need to pass the ID of the value that is being looked up, not the value that is in the “master” OLE DB source.
    Rough explanation, OLE DB Source value for column “Approp” is “4005” --> SQL matches “4005” with the ID in the new lookup table (“4005” = ID “5” as defined in the SharePoint lookup list) --> “5” gets passed into SharePoint List destination lookup
    column --> SharePoint displays “4005” and successfully links to the lookup list.
    Funny thing (not really), the error(s) outlined in my original post are not related in getting data into a SharePoint Lookup column as I am now successful in getting data into the system but I am still getting the same above error(s). I think it has to do
    with the ID column in the SharePoint list destination. What I can’t seem to figure out is why since I am not linking any data to that ID column (at least on new records). I am however linking it on Update and Delete and the errors mentioned above disappear
    and things work well.
    There are three tasks that need to get done in order to get data from SQL into a SharePoint lookup column assuming you have already set up your SharePoint lookup lists:
    1. Create new lookup table(s) in SQL that has the IDs from the SharePoint Lookup list and the values coming from the “master” OLD DB Source. You can see the ID column in SharePoint by toggling it on in a view.
    2. Create a SQL command that JOINs all the databases and tables so that the ID is passed and not the value into the SharePoint lookup column
    3. Change the “Data access mode” to “SQL Command” instead of the “Table or view” in the OLE DB Source and paste your command into the “SQL command text:” area.
    Other helpful info is that you may also need to add additional columns in the new lookup tables in SQL for the scenarios when the data is not unique. You can see this two times in my SQL command example for Units and JobTitles:
    SELECT
    pps.SSNm,
    pps.file_updated,
    pps.Employee_id,
    /* pps.CheckDistNm,*/
    Check_Distribution_id = COALESCE( d.ID, 0 ),
    pps.Job_nbr,
    pps.SeqNm,
    pps.action_eff_dt,
    Fund_id = COALESCE( f.id, 0 ),
    Appropriation_id = COALESCE( ap.id, 0 ),
    ActionCode_id = COALESCE( ac.id, 0 ),
    SpecNumber_id = COALESCE( jt.ID, 0 ),
    pps.Employee_id,
    /* pps.Fund,
    pps.Approp,
    pps.Unit,*/
    Unit_id = COALESCE( u.ID, 0 ),
    PosNm,
    PosCode,
    pps.LastName,
    pps.FirstName,
    pps.MI
    FROM
    x_PPS.aReportVw.pps_screens_active AS pps
    LEFT OUTER JOIN dbo.DistributionNumbers AS d ON
    pps.CheckDistNm = d.Check_Distribution
    LEFT OUTER JOIN dbo.Units AS u ON
    pps.Fund = u.Fund AND
    pps.Approp = u.Approp AND
    pps.Unit = u.Unit
    LEFT OUTER JOIN dbo.Appropriations AS ap ON
    pps.Approp = ap.Approp
    LEFT OUTER JOIN dbo.Funds AS f ON
    pps.Fund = f.Fund
    LEFT OUTER JOIN dbo.ActionCodes AS ac ON
    pps.ActionCode = ac.ActionCode
    LEFT OUTER JOIN dbo.JobTitles AS jt ON
    pps.SpecNm = jt.SpecNumber AND
    pps.JurisClass = jt.JurisClass

  • Create a trigger to check inserted date is before or after SYSDATE

    Hi,
    I am trying to create a trigger that will check an inserted date against SYSDATE and alter the value (i.e. make it SYSDATE) when the entered date is incorrect.
    For example, I have a Customer table with a record named MemberDate which, when a date is entered to it, will be checked by the trigger to ensure it is not before the current date.
    My code so far;
    CREATE OR REPLACE TRIGGER Customer
    BEFORE INSERT ON
    Customer
    FOR EACH ROW
    DECLARE
    e_invaliddate_ud EXCEPTION;
    BEGIN
    IF :NEW.MemberDate < SYSDATE THEN
    RAISE e_invaliddate_ud;
    END IF;
    EXCEPTION
    WHEN e_invaliddate_ud THEN
    DBMS_OUTPUT.PUT_LINE('The date entered for MemberDate is invalid. The
    MemberDate has been set to the current date');
    END;
    So far, this trigger only returns an error message but allows the date to be entered even if it is incorrect. I have tried a few ways of altering the entered date to SYSDATE but to no avail.
    I am running scripts using SQL PLUS and inserting data using
    INSERT INTO Customer
    VALUES(CustomerID, ..., MemberDate);
    Where the values entered will be checked to ensure the MemberDate is not before SYSDATE.
    The MemberDate data-type is DATE and has a rule that it must not be before the current date. I am aware that a constraint may not be used to perform a check using SYSDATE, this is why I am trying to make a trigger.
    However, my knowledge of triggers is limited
    If anyone can help, I will be very Happy.
    Thank you in advance.

    Use this if you want an error message that halts the execution:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      if :new.memberdate < sysdate
      then
        raise_application_error(-20000,'The date entered for MemberDate is invalid.');
      end if;
    end;Use this if you want to automatically to overwrite the MemberDate with sysdate without an error message:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      :new.memberdate := greatest(sysdate,:new.memberdate);
    end;Note: untested
    Regards,
    Rob.

  • Inserting data from one table to another table....

    Hi DB Gurus,
    I have two table like table A in instance X and table B in instance Y. I want to insert data into table A from table B.If data in table B already exist in table A then that should not insert .if data In table B is not present in table A then that data should insert into table A.
    please help me to how insert this kind of data.I am trying to insert data by using "insert into" statement.Is it correct way or not. please let me know...
    Thanks in advance
    Best regards
    kumar

    Hey There,
    "I have two table like table A in instance X and table B in instance Y"
    Are these 2 instances sitting in the same db/rac.
    if so
    insert into x.a
    select * from y.b
    If the 2 instances are in different databases/racs then i think you can add a linked db into your script.- not 100% about that though.
    Dob

Maybe you are looking for

  • Bt openzone/FON connection issue

    Ok so I often use this specific btopenzone wifi hotspot, used it for a couple hours every now and again for ages. Hit a problem now though my laptoop no longer connects to it. it sees it i click connect but it just keeps coming up no internet connect

  • All creative suite (cs3) programs quit unexpectedly upon startup

    Hey there, Been having some issues with Photoshop, Dreamweaver, Indesign and Illustrator. Whenever I open I immedietly get the error message 'Photoshop quit unexpectedly'. I have tried repairing my permissions, no updates have been installed, everyth

  • Error in MSS_FORMAT_RELEASE during Patching SAPKB70107

    Hi All, we are having issue during the support package upgrade abap and basis component SAPKB70107 and SAPKB70108,the upgrade stuck in XPRA_EXECUTION with bellow error: Post-import method MSS_SDBP_AFTER_IMP started for SDBP L, date and time: 20110114

  • Anyone else getting an error message in Itunes right now?

    I keep getting an error message that has (error -50) and check back later in it. Any one else getting this?

  • Where are the Auidio/ Video Settings

    Capture tells me to adjust the Audio/Video settings. Where are these settings and what do I set them to.