How to format dates in SQLExec query

I am trying to archive Lookout data to an Oracle database using SQLExec. I started with existing SQLExec code that put data into Access. Following is that code:
"Insert into wind_temp (Rdate,Wind,Temp) values ("&text(now(Timer3),"0.00000000")&",
"&text(\\SCADA1\Server\Drivers\Corral\ROCSouth.Wind,"0.000")&",
"&text(\\SCADA1\Server\Drivers\Corral\ROCSouth.Temp,"0.000")&")", 8, no);
The Rdate column in wind_temp table is date type. If I change the type to varchar2 (string) this works, so my ODBC connection is good. The problem is that for date fields Oracle needs a string in DD-MON-YYYY (i.e. 01-JAN-2002) format or string data converted to a date (i.e. to_date('01-JAN-2002 12:00:00','DD-MON-YYYY HH24:MIS')). Is there a way
using the now() or other function to build a "to_date" string like above to pass to Oracle?

Here you go:
text(now(),"dd/mm/yyyy hh:mm:ss")
This will give you slashes and not dashes and a number for the month and not the abbreviated name.
Here is the expansion that does what you need:
left(text(now(),"dd/mm/yyyy hh:mm:ss"),2)&"-"&if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="01","JAN",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="02","FEB",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="03","MAR",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="04","APR",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="05","MAY",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="06","JUN",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="07","JUL",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="08","AUG",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="09","SEP",if(m
id(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="10","OCT",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="11","NOV",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="12","DEC","ERROR"))))))))))))&"-"&mid(text(now(),"dd/mm/yyyy hh:mm:ss"),7,15)
The date I got from this was:
11-APR-2002 11:54:35
I would recommend using multiple expression objects to simplify reading the code. I included it here, all in one expression, so you could copy and paste it for testing.
I tested it on Lookout 5.0. It works.
Study the text() function and the general text manipulation functions. You can do just about anything with a little creativity.
Regards,
Tommy Scharmann

Similar Messages

  • Form Letter Report - How To Format Date and Number Hidden Fields

    Hi
    Is it possible to format date and number fields in a form letter report. This case were Paper Design shows fields as $<hire_date>. The examples in reference book only print character values which do not require formatting. I cannot determine how to achieve this. Cannot select fields from Paper Design view as per other report styles where can apply formatting. Do I have to perform formatting in the query to return date as string in format I wish for? This is not case for other report styles.
    Thanks

    you could add a field, set the source of the field to hire_date (assuming hire_date is a column in the data model), and put a format mask of whatever format you want. then set visible to No.
    then instead of &<hire_date> you can instead type &<name of your new field>.

  • How to aggregate data in SQL Query

    Hi,
    I have Table1 field1 and field2. Combination of these fields form the key of this table.
    Next I have Table2 with field3 and field4. field1 is the unique key for this table.
    My query is:
    select T2.field4||','||T1.field2 from T1 inner join T2 on T1.field1 = T2.field3;
    In the result I want to aggregate the data by T2.field4
    How do I that? Please help
    Thanks in advance,
    Raja

    How to aggregate data in SQL Query By using aggregate functions and group by:
    SQL> select object_type, count(*), sum(decode(status,'VALID',0,1)) inv_obs
      2  from all_objects
      3  group by object_type;
    OBJECT_TYPE                     COUNT(*)              INV_OBS
    CONSUMER GROUP                         2                    0
    INDEX PARTITION                      970                    0
    TABLE SUBPARTITION                    14                    0
    SEQUENCE                             226                    0
    SCHEDULE                               1                    0
    TABLE PARTITION                      349                    0
    PROCEDURE                             21                    0
    OPERATOR                              57                    0
    WINDOW                                 2                    0
    PACKAGE                              313                    0
    PACKAGE BODY                          13                    0
    LIBRARY                               12                    0
    PROGRAM                                9                    0
    INDEX SUBPARTITION                   406                    0
    LOB                                    1                    0
    JAVA RESOURCE                        771                    0
    XML SCHEMA                            24                    0
    JOB CLASS                              1                    0
    TRIGGER                                1                    0
    TABLE                               2880                    0
    INDEX                               4102                    0
    SYNONYM                            20755                  140
    VIEW                                3807                   72
    FUNCTION                             226                    0
    WINDOW GROUP                           1                    0
    JAVA CLASS                         16393                    0
    INDEXTYPE                             10                    0
    CLUSTER                               10                    0
    TYPE                                1246                    0
    EVALUATION CONTEXT                     1                    0

  • How to diasable Data Edit in Query Builder?

    Is there a way to disable Data Edit in Query Builder in Dev6? When QB was part of Discoverer as Browser it was possible via BROWSER_PROFILE. The QB now ignores this neither it have any table instead. There is note in help that the feature is disabled by default and admin should have to enable it, but, seems, it is occasionally left from previous releases.
    TIA,
    Uldis

    Hi,
    What did you mean the “string”? What did you want to do to use the string parameter?
    Did you mean managed properties?
    If you mean the managed properties, you can just select the managed properties in the query builder, the query builder would automatically generate the path.
    There are some articles about the query builder for your reference.
    http://en.share-gate.com/blog/sharepoint-2013-content-search-site-portal
    http://blogs.technet.com/b/mspfe/archive/2013/02/01/how-query-rules-and-result-sources-can-be-used-to-customize-search-results.aspx
    What’s more, there are some restrictions for KQL, you can also have a look at it.
    http://msdn.microsoft.com/library/ee558911(v=office.15)
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to Format Date / Time

    I found out how to retrieve date and time from the operating system, but how do i format it.
    I need the short and sweet versions.
    Example:
    // Retrieving from the operating system.....
    String system_date = new java.util.Date().toString();
    Now I want to parse the date string... for instance retriving the current date in this format (DD-MON-YYYY)....
    if u know another way to retrieve the date without parsing the string so I can just pull the year instead of everything....
    Thank You In Advance

    Try out this code:
    //TO GET THE YEAR AS A NUMBER, USE DE java.util.Calendar class
    Calendar rightNow = Calendar.getInstance();
    System.out.println("My age is " + (rightNow.get(Calendar.YEAR) - 1971));
    //TO FORMAT A DATE IN YOUR LOCALE USE, java.text.DateFormat
    DateFormat df = DateFormat.getInstance();
    System.out.println("The date right now is " + df.format(new Date()));
    //TO FORMAT A DATE IN ANOTHER FORMAT AND LOCALE...
    DateFormat df2 = DateFormat.getDateInstance(DateFormat.SHORT, Locale.CHINA);
    System.out.println("The date right now in China is " + df2.format(new Date()));
    I hope this soves your problem,

  • How to format Data in subject line of an Email

    I have an email submit button on my LiveCycle form and the client wants data from the form in the subject line of the email. I have the button set up and the patterns set up on the fields but the data in the subject line doesn't display the way it does in the fields. this is what I have.
    var oDoc = event.target;
    var nSubject = Page1.Top.txtEmpID.rawValue + " " + Page1.Top.dteTo.rawValue;
    oDoc.mailDoc({
    cTo: "[email protected]",
    cSubject: nSubject,
    cMsg: Page1.Top.txtLastName.rawValue + " " + "Performance Agreement"
    The Employee ID is 7 digits including leading zeros (0123456) and the date is formatted MM-DD-YYYY. When it goes to the subject line it doesn't show the leading zeros (123456) and the date is formatted YYYY-MM-DD.
    Any help is appreciated, Thanks.

    To get the formatted date striong use formattedValue instead of the rawValue in your scriptings.

  • Formatting Date in af:query component in ADF

    Hi,
    i am using <af:query>  ADF Component.It is binded to a VO through which attributes are getting displayed in the search.
    i have a date component in the vo and want the date format to be displayed as '06-AUG-2013'. how can i achieve this?

    You can set a date format in the VO. Open the VO, go to "Attributes" and double click the attribute. In the Popup go to "Control Hints". Choose "Simple Date" in the field "Format Type". Then enter the format you want to be applied into the field "Format" (e.g. dd-MMM-yyyy).
    Regards,
    Linda

  • How to format data for a custom group

    Hi all
    I have a pivot table with Actual and Budget as columns and some accounts in the rows. Since I'm using the account hierarchical column, I created custom groups for the accounts using the Selection steps pane. For example, I created a new group called Profit to combine 3 different Profit accounts and display one Profit line.
    Now I want to format the data for the Profit group. I right-click on the Profit group, choose to edit the group and click on the Format button on the bottom left corner. I add some formatting, e.g. borders. When I now view the pivot table, borders have been applied to the label of the group - so the word Profit is now bordered. However, the values in the Actual and Budget columns do not have a border. Don't know what I'm missing, but I want both the group label and the values to be formatted the same way.
    How can I apply formatting to the data/values for the custom group?

    Yeah tried that already, it formats the entire column whereas I need just the values for the Profit row to be formatted. Seems it is a limitation only when using custom groups?

  • How to load data from a query?

    Hi all,
    I'm not very familiar with ODI, but we already use it to load table (to Hyperion Planning).
    Now, we need to execute a query (I don't want only to apply filter), that cross differents table, to load it. We can't create view in the datawarehouse.
    How can I do this? What is your recommendation?
    Thanks for your help

    Yes, this is possible.
    Start with a single query that returns you the data for all lecturers.
    Right-click on the "all lecturers" query in the queries pane, and choose Reference, once for each lecturer. This will create a query for each lecturer.
    Open the query for each lecturer and filter the data so that only that lecturer's results are visible.
    Click "Close & Load To..." for each lecturer's query  to load the data into the data model. This will create a data model table for each lecturer.
    If your question is more about how to transform such a survey list into a table that can be easily filtered, please provide an example of how the list shows up in Power Query.
    Ehren

  • How to format date with in the file

    Hi,
    I have the below data in a file,
    101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    5200xxxxxxxxxx D18000_1 CCDXXXXXXX JUL 31201207 1140689340000001
    622113010547999999999003 000333333334RE 00030137 onee SYSTEM 0140689340000001
    62200000 0000999999999001 0000011111CR460 00030135 twoo system 0140689340000002
    82000000040015507087000000000000000003571110D18000_1 140689340000001
    Can some one tell me how to read the date which is there in line 1 which is starting with indicator 1 at position 24 to 29
    in this example it is 120731
    which is in YYMMDD format
    I want to replace from 70 to 75 with above date + 2 as 120802 in 2nd line which starts with indicator 5
    My output should look like below in a file again
    101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    5200xxxxxxxxxx D18000_1 CCDXXXXXXX JUL 31120802 1140689340000001
    622113010547999999999003 000333333334RE 00030137 onee SYSTEM 0140689340000001
    62200000 0000999999999001 0000011111CR460 00030135 twoo system 0140689340000002
    82000000040015507087000000000000000003571110D18000_1 140689340000001
    Can some one please tell me how to do this?
    Appreciate your response.

    The following will help you to extract the date and perform an arithmetic function on a date:
    olddate=$(head -1 myfile | cut -c 24-29)
    newdate=$(date -d "20${olddate} + 2 days" "+%y%m%d")You may have to implement some logic if the year is before this century, e.g 1999. For the rest I suggest you look into awk or sed to perform a string replacement based on character position.
    Edited by: Dude on Aug 7, 2012 12:57 PM

  • How to format date faster than SimpleDateFormat

    Hi All,
    Can someone tell me way to format the date faster than SimpleDateFormat.
    Thanks in advance.
    Cheers!!
    Puneet

    At times when we declare formatter again and again,
    the SimpleDateFormat's performance is less as
    compared to the apache's FastDateFormat..1) Decaring it wouldn't be what makes it slow. Instantiating it would.
    2) As already stated--simply don't instantiate that many of them. Create a few and reuse them.
    3) So what if the other one is faster? Have you run into actual problems with SimpleDateFormat being a bottleneck? A Ferrari is faster than my car, but it makes no significant difference for how I use a car. I would not realize any meaningful speed improvement if I had a Ferrari.
    4) If the other one is faster and it's that buggerall important, then use the faster one.
    . So I was
    trying to find out if Sun has something to solve my
    problem.You can peruse the API docs as well as anybody else.
    I am using the formatting in batch process
    so data to process is huge.Have you found a bottleneck? Have you put a profiler on it? Have you determined that it's the parsing that's causing the problems and that creating is negligible?

  • How to format Date uptil the milliseconds

    Hi All,
    I am trying to use XSLT transformation and i need a timestamp till the milliseconds.
    I used the following function and it gave me time uptil seconds
    xp20:current-dateTime()
    So i added this transformation
    format-datetime(xp20:current-dateTime(), "[Y0001][M01][D01]_[H01][m01][S01][N001]")
    But it does not work. The transformation is failing. Can someone guide me as to how to achieve this?
    -Thanks in Advance,

    http://www.w3.org/TR/xslt20/#date-picture-string

  • How to format date/time in display hints?

    To those of you who know it:
    One of the attributes in a VO is of Date type. To display of the date in the format of "10/25/2009 11:45 PM", I only managed to display "10/25/2009 11:45" with only the clue of the few examples provided in display hints when doing the formatting (the format mask I use is MM/dd/yyyy hh:mm). I would appreciate it if someone could advise how to display the AM/PM part of the format mask. Or better yet, point me to a source of reference for such formattnig.
    Thanks!
    Newman

    Newman,
    As suggested by Puthanampatti, you have to use 'a' in the date pattern to display AM/PM.
    You can find date and time patterns in [SimpleDateFormat API doc|http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html] which describes more about the letters to be used for each pattern which you can also use with attribute display hints in VO.
    Sireesha

  • How to format date and currency datafield in a Datagrid

    Hy folks
    I am getting my data from a web service (against a SQL server)
    After that convert the data in an ArrayCollection and
    Finally I use the ArrayCollection in a Datagrid ussing somethig like :
    <mx:collumns >
    <mx:DataGridcolumn datafield="EnvoiceDate" />
    <mx:DataGridcolumn datafield="EnvoiceValue" />
    How can I format a date tipe datafield in a Datagrid.
    I need to display da date in an format like  DD/MM/YYYY   ex     12/10/2009.
    I also need to display da number like 1345.87   as  1.345,87
    thanks in advance

    Binoy,
    create fields that refer to DATS and TIMS data types
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Aug 5, 2010 10:28 PM

  • How to bind data from BEx Query to BO Dashboard

    Hi
    Could someone please share screenshot steps how to bind BEx Query data into BO Dashboard.
    We've created BICS Connection .....
    It will be helpful if someone can share screenshots of building small Dashboard on BO Dashboard.
    Thanks,

    Hi Pawan,
    Please find the below links, there are many links to this in SCN search there  before posting you could save lot of your time.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a01a9a87-936f-2f10-e6b9-dbb1ec5064ff&overridelayout=true
    http://scn.sap.com/docs/DOC-47314
    Thanks&Regards,
    Krishna

Maybe you are looking for

  • How to Select Multiple Projects?

    Another: "Wait a sec -- you mean Aperture still can't...?" question... So I'm in the Inspector's Projects tab. I've just created and named a new sub-folder, into which I want to drag several dozen projects. I've tried Cmd-clicking; I've tried Shift-c

  • Has anyone got gma3650 or gma3600 working?

    Hi, I'm currently considering buying this netbook: http://www.johnlewis.com/231577593/Product.aspx It has the dreaded gma3650 chipset, which seems to cause lots of issues.  I have found this on the wiki: https://wiki.archlinux.org/index.php/Intel_gma

  • Acrobat Pro and no menu in office 2011

    I recently switched to a Mac with office 2011 and bought acrobat x pro.  There is no ability to pdf a group of emails (as an archive) with embedded attachments which I found very useful on my old PC with office 2003 in tandem with acrobat pro 8 or 9.

  • Is there a Mac-compatible wireless print server?

    This is a variation on a theme many have touched upon. I want to have my Airport Extreme wirelessly connected to two printers (B&W laser, and color inkjet) currently connected by USB cables, stretched to 16' limit. Printers can't be moved convenientl

  • Personnel subarea  changed in hr module but not reflecting to bi with same

    Dear all             below is the scenario at present personnel subarea  for employee in april was  as   1111. personnel subarea for that employee in MAY IS       1120                                 that is one employee changed from personnel subare