SP2-0246 when COLUMN FORMAT DATE in sqlplus

Hi,
I've read in 'Oracle 11g SQL' Jason Price book that I can format column of DATE type in sqlplus by i.e.:
COLUMN <name> FORMAT 'YYYY'
but when I tried then got:
SQL> SELECT table_name, column_name, data_type FROM user_tab_columns WHERE data_type LIKE '%DATE%';
TABLE_NAME COLUMN_NAME
DATA_TYPE
CUSTOMERS DOB
DATE
CUSTOMERS2 DOB
DATE
ORDER_STATUS LAST_MODIFIED
DATE
SQL> COLUMN dob FORMAT YYYY
SP2-0246: Illegal FORMAT string "YYYY"
Well, there is mistake in the book or I'm doing sth in wrong way???
greetings
mac

Welcome to the forum.
Usually this is done through NLS_DATE_FORMAT:
SQL> create table t as select sysdate dt from dual;
Table created.
SQL> desc t
Name                                      Null?    Type
DT                                                 DATE
SQL> column dt format YYYY
SP2-0246: Illegal FORMAT string "YYYY"
SQL> column dt format "YYYY"
SP2-0246: Illegal FORMAT string "YYYY"
SQL>  column dt format 'yyyy'
SP2-0246: Illegal FORMAT string "yyyy"
SQL> select * from t;
DT
24-03-2013 14:08:39
SQL> alter session set nls_date_format = 'YYYY';
Session altered.
SQL> select * from t;
DT
2013
SQL>

Similar Messages

  • Error When Refresh Formatted Data inside Excel Analyzer

    I have build a Excel template and load up this to the BI Publisher Server. When I call this template after the log in works fine. When I refresh the data normal it works also fine, but when I try to refresh formatted Data I get the error "Error: This report does not support HTML as an output format." I will not use html output inside Excel, I will use the original Excel template with refreshed data.

    Hi Tim,
    The Refresh Formatted Data works on MS Excel 2003.
    May need to check if its really supported on MS Office 2002.
    Btw another question, is it possible to create an excel template without using Excel Analyzer?
    Also when I used the generated excel file of Excel Analyzer as template, when the report is generated the data sheet sometimes is not filled with correct data or sometimes there is no data at all, even if the parameters used is the same as the one used in generating the original excel file using Excel Analyzer. This happens most of the time for reports with Concatenated Queries or SQL Queries using "CURSOR" to group a set of data. Note that on initial generation of excel file using Excel Analyzer, correct set of data is displayed. It is only when it is used as template and viewed/exported in Excel format that data is not properly loaded.
    Please advise.
    Thanks!
    Uniz

  • How to set correct date format in OAF when column is Varchar2

    All,
    We have used personalization to render a couple of fields in OAF and these fields are date fields. However, these fields point to attribute fields which are defined as varchar2 in the VO. We would prefer not to extend the VO to change the data type to date.....what else can be done?
    See...what is happening is, upon navigating to the fields and you select a date (using the calender), the format is dd-mon-yyyy, however, if the page is either refreshed or some other page event, the format reverts to yyyy-dd-mm and we then get a form validation error.
    While we have a preference not to extend VO, I will entertain any suggestions/solutions. Thanks.

    Hi,
    Thanks a lot and thanks for your time and good solution.
    This the syntax is used for Date datatype :<?format-date:CREATION_DATE;' MON- YY'?>
    and for varchar data type <?concat(' ',/XLAAARPT/P_PERIOD_FROM)?>.
    Thanks & Regards
    Srikkanth

  • How to give the length , cardinality and format when creatin a data type?

    Hi,
    I am new to XI and i wish to know how to give the cardinality ,format and length when creating a data type .Also please let me know how to give the following?
    cardinality --repeating and required
                      non repeating , optional
    thanks and regards

    When you are defining the elements of the datatype there are columns where you can do what you need:
    <b>column type</b>: here you choose the type of data of the element
    it can be a standard type or a user defined one (if you click one time only it should appear an icon in the right for input help: click there and choose the type you need)
    <b>column occurence </b>: in a similar way of column type here you define the cardinality of the element (min occurence and max occurence)
    setting min occurrence: 1, max occurrence 1 or unbounded --> required
            mmin occurrence 0, max occurrence 0, 1 or unbounded --> optional
    about the attributes there are directly the choice between required or optional.
    <b> column details </b>: here you define the length of the  element if it is a string or a lot of other things if the type is a different one.
    I hope this will help you

  • EAS data export in column format question

    I am trying to export data in column format and import back to replace 0 with #Missing. I want to see if it will reduce any blocks. When I export I am getting data header members from a different dimension other that Period. It is getting tricky to map these many data rows in rule file as oppose to 12 from Period.
    What determines this behavior. I know I have tried in the past (different app) and Period came through as data header record.
    Any help is appreciated.

    You can't directly control which dimension is selected (at least, not without changing your cube) in a native export.
    However, for what you are doing, you do not need a load rule - you could just find-and-replace in the file.
    You can also try converting zero to #Missing with a calc script (see Re: BSO Level 0 Block Analysis Advice) although it's going to be slow and you'd need to defrag with a dense restructure afterward.

  • Averaging column with date/time format in BI Answer

    Hi everyone
    we are working on BI answer and training to get the average of the working hours of the departments. The Working Hrs column is Date format in the Database so we tried to converted to CHAR through Cast Function from Edit columns Formula in Answers BI, and this gave us date "2007/09/01" as result!! We also tried to cast the Working hours to:
    CAST(WORKING HOURS AS CHARACTER FORMAT 'yyyyMMdd-HHmmss')
    NOTE: In the Working Hours we have null values...
    the actual working hours appear in Answer Table is "7/1/2009 6:13:00 AM"
    How to get the Working Hours column Average on Answer BI?
    Appreciate your help
    Regards
    Edited by: user817525 on Jul 21, 2009 11:15 PM

    how about next solution:
    60 * EXTRACT( HOUR FROM ATTENDANCES.A_ATT_TIME) + EXTRACT( MINUTE FROM ATTENDANCES.A_ATT_TIME)
    with this u have minutes for working day. If u divide this expression with 60:
    (60 * EXTRACT( HOUR FROM ATTENDANCES.A_ATT_TIME) + EXTRACT( MINUTE FROM ATTENDANCES.A_ATT_TIME)) / 60
    u now have hour with decimal (for 8:52 is (8*60+52)/60 = 8,67 )
    and u only need to round this number.I hope this help
    ps.when u have new question probably is good way to create new thread
    all best
    Phenix
    Edited by: Phenix on Aug 5, 2009 8:01 AM

  • Change date column format in Microsoft Access db?

    Hi,
    I'm completely new to Java so I'm unsure how easy\hard this my question is...
    A Java application I'm working on creates an Access mdb (through some 3rd party API's) in that mdb there are some columns of type date with values of date-time. The user does not want to see the time when they create reports in Access.
    So two solutions would be to either (a) set the column format to Medium Date or (b) truncate the values in the row.
    Method (b) should be much quicker since it is not altering any values...but is this possible to do in Java? I'm not sure even where to start.
    Also I tried method (b) using sun.jdbc.odbc.JdbcOdbcDriver but have had some issues (just not updating values)...not sure what the cause is so I'll continue to bang away at that (unless someone has some sample code that would be great also).
    Thanks,
    Frank

    You should not change this format. The default date format complies with the "common log format" which is readable by many log analysis tools.
    That said, if you still want to change the date format, you can replace %SYSDATE% with %LOCALEDATE% in your flex-init line. LOCALEDATE will cause the WS to use the date format set by your OS.

  • How do I maintain column formatting when converting from PDF to Excel?

    How do I maintain column formatting when converting from PDF to Excel? All info is no longer on the lines or in the columns they started out being in? Any help would be appreciated.

    Sara,
    Perhaps I am expecting too much from Adobe ExportPDF. The reason I subscribed to this service, for which I pay a yearly fee, was that I need a way to  convert scanned and digital documents to Word &/or Excel. I read the link you included but to be candid the more I tried to understand what was written the more confused I got. The process should not be this difficult. Currently I am using a NEAT scanner to create PDF documents of whatever I scan. After I changed the OCR setting on Adobe ExportPDF the output was much better but not to the point it was usable as it was. Information that appears to be lines and columns are sometimes not recognizing two columns and just putting them together in one. Obviously not usable. The other thing it does is bunch numbers that appear in a column that are just a bunch of numbers that I have no way of fixing. 
    Please let me speak to someone who can help me. Right now I not getting anything of value in my paid subscription.

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • Column in DATE format

    Hello Everybody
    I have a report did Apex, this report has a column which data type is DATE but by default the Apex put it in the format : DD-MM-YYYY HH:MI:SS
    But I only want that his column has the format DD/MM/YYYY
    I know that is posible convert this field using the function TO_CHAR(date, format) but in the report I want to sort this field considering that this filed is in date data type not in char.
    Also I know that I can use the function EXTRACT for concatening the day, month and year and after convert to date in the format 'dd/mm/yyyy'; but I don´t want to write many code.
    I don't want to do some like this:
    TO_DATE(
    EXTRACT( 'DAY' FROM DateFiled )||'/'|| EXTRACT( 'MONTH' FROM DateFiled )||'/'|| EXTRACT( 'YEAR' FROM DateFiled ), 'DD/MM/YYYY' )
    Do you know how to convert to this date format (DD/MM/YYYY) preserving the format?
    I expect your prompt reply.
    Any help will be very appreciated.
    Best Regards

    Hi Eric
    One of the really cool features of the later versions of APEX is the ability to set a default "Application Date Format".
    This is done in the Application xx>Shared Components>Definition then select the "Globalization" tab.
    You can select from a list of pre-defined date formats, or enter your own.
    My preference is "DD-Mon-YYYY" which is not in the list.
    Just leave your date fields as regular DATE type in the select (no formatting in the select).
    This Application Date Format is then used as the default for ALL dates for which you don't specifically set (another) date format
    This is also selecable in the Display options of a "Date Picker (Use Application Date Format)" LOV - for any date page items that you want to provide a date picker.
    This really simplifies the effort in getting a consistent look and feel - and keeping a constant standard throughout the application.
    The other benefit is that you can make a change in one place, and ALL the dates (without a specific date format specification) will change format - just like that.
    This is just one of the features that makes APEX the most productive - and cool - systems around.
    Enjoy!
    Mike

  • EXport Data to Excel with Columns format

    Dear All,
    This may  be a basic question, however, I just need a tip to conclude my issue. 
    I have a Report that displays Financial Budget data (AFE).  I am able to download to the Excel sheet.  However, I need to conclude it with the column formatted at code itself and not given to the user.
    That is I want to set couple of column to Numeric, and Set Colum width defined at Code level itself.
    I am already using the Function module : MS_EXCEL_OLE_STANDARD_DAT
    Regards,
    Venkat

    data: go_excel       type ole2_object,
              Go_CELL        TYPE OLE2_OBJECT,
              go_workbooks   TYPE OLE2_OBJECT,
              go_workbook    TYPE OLE2_OBJECT,
              go_sheet       type OLE2_OBJECT,
              go_application type OLE2_OBJECT,
              go_activesheet type OLE2_OBJECT,
              go_text        type OLE2_OBJECT.
        gv_EXTRD = sy-datum.
        gv_EXTRT = sy-uzeit.
        concatenate pfile gv_EXTRD gv_EXTRT  'check.xls' into gv_file.
        clear: gt_export, gs_export.
    ****INITIATE EXCEL
    Create object Excel
        create object go_excel 'EXCEL.APPLICATION'.
        set property of go_excel 'Visible' = 0.
    Create workbook object
        call method of go_excel 'WORKBOOKS' = go_workbook .
      Add workbook
        call method of go_workbook 'Add' = go_workbook.
        lv_line = 0.
        loop at gt_collect ASSIGNING <collect>.
          lv_line = lv_line + 1.
          move-corresponding <collect> to gs_export.
          clear: gs_export-ZALDT.
          concatenate <collect>-ZALDT4(2) '-' <collect>-ZALDT6(2) '-' <collect>-ZALDT+0(4)
               into gs_export-ZALDT.
    Populate cells
          call method of go_excel 'Cells' = Go_CELL
            EXPORTING
              #1 = lv_line
              #2 = 1.
    **************SET UP PROPERTY WIDTH ****************************
          SET PROPERTY OF GO_CELL 'ColumnWidth' = '11'.
          SET PROPERTY OF GO_CELL 'Value' = gs_export-BANKL.
    ***********SET PROPERTY CELL NUMBER**************************************
          call method of go_excel 'Cells' = Go_CELL
            EXPORTING
              #1 = lv_line
              #2 = 4.
          SET PROPERTY OF go_cell 'NumberFormat' = '@'.     "PROPERTY NUMBER
          SET PROPERTY OF GO_CELL 'ColumnWidth' = '10'.
          SET PROPERTY OF GO_CELL 'Value' = gs_export-ZALDT.
    endloop.
    **CLOSE EXCEL**********
        CALL METHOD OF go_workbook 'SaveAs'
          EXPORTING #1 = gv_file
          #2 = 1.
        "file format
        CALL METHOD OF go_workbook 'close'.                                    "file format
        call method of go_excel 'QUIT'.
    ****OPEN CREATED EXCEL FILE ****************************
        call method of go_excel 'Workbooks' = go_workbooks.
        call method of go_workbooks 'Open'
          EXPORTING
            #1 = gv_file.
        set property of go_excel 'Visible' = 1.

  • List all of the existing column and there column format and data format?

    Hello Gurus,
    I am new to OBIEE and i have a requirement to verify the column format and data format for all of the existing column while generating a analysis report. Is there any way i can list down all of the columns which are exposed and list there column format and data format?
    For checking the individual column properties i know there is an option called 'Column Properties' but want to know all in once go.
    Kindly help me and thanks in advance.
    Thanks

    I don't think you have anything in answers to get that, Go to Repository and Utilities -> Generate Metadata Dictionary that will give columns and datatype.
    Award points if it helps
    ~Srix

  • Struts - Formatting date in display:column tag

    Hi ,
    I am using the following code to format the date in my display tag
    <display:column headerClass="myclass" property="submittedDate" title="DATE SUBMITTED" decorator="org.displaytag.sample.LongDateWrapper" />     which displays the date like '12/22/2005 00:00'
    I don't need this format . Instead ,I want to extend the decorator and create my own . For that , I'm using
    import java.text.SimpleDateFormat;
    import org.displaytag.decorator.TableDecorator;
    public class DateDecorator extends TableDecorator{
         public DateDecorator(){          
              super();
              System.out.println("Date decorator constructor called...");
         public String getSubmittedDate(Object obj){
              SimpleDateFormat sdf = new SimpleDateFormat();
              sdf.applyPattern("MM/dd/yyyy");
              System.out.println("In getSubmittedDate()...");
              String date = sdf.format(obj);
              System.out.println("Formatted date is ::"+date);
              return date;
    but at runtime it gives me the classcast exception saying that
    class DateDecorator could not be loaded .
    Kindly guide me through it .
    Thanks

    Decorator class that you wrote is "DateDecorator" and the decorator class that you used in the tag is "LongDateWrapper".

  • Import csv through SSIS package - format date column

    Hello -
    I need to import a csv file to SQL server using SSIS.  The date column in excel is, for example, 7/8/2014, but it imports as 41828 in SQL Server.  How can I convert this?
    Any help will be greatly appreciated!

    Hi,
    According to your descrition, date column convert to string data type column when import data from a csv file to SQL Server table. While you want the column still stores as date data type in SQL Server table.
    In order to achieve this goal, there are several methods:
    Add a Derived Column Transformation before the OLE DB Destination. Then add a derived column  to replace the date column with the expression like bewlow to convert the column to date data type:
    (DT_DBDATE)column_name
    Add a Data Conversion Transformation before the OLE DB Destination.Then convert the date column to date[DT_DATE] data type. Use the new column as the destination column.
    In the OLE DB Destination Editor, we can change the data type from varchar(50) to date when create a table as the destination.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Turn all format (data, columns, rows) from english to chinese?

    Is there any possibilities that OBIEE report can be turn into Chinese language. I mean a function that can change all english format (data, colums, rows, etc) into chinese especially mandarin. Right now, what I found is that I need to find the chinese translation for all the english terms used in the report and convert them one by one.

    Hi,
    translating column names can be done using "Externalizing Display Names":
    http://oraclebizint.wordpress.com/2007/10/29/oracle-bi-ee-101332-presentation-layer-translation/
    translating report captions can be done by using language dependent captions:
    http://oraclebizint.wordpress.com/2007/10/19/oracle-bi-ee-10133-presentation-catalog-captions/
    translating data in your tables can be done by snowflaking a translation table on your dimension tables.
    Regards,
    Stijn

Maybe you are looking for