Update a date type in a table

I am trying to update a date type coloumn in table;
declare
cursor cur is
select current_doh
from adp_service_dates71608
for update of adp_service_dates71608.current_doh;
rec cur%rowtype;
begin
for rec in cur loop
dbms_output.put (
to_char (rec.current_doh
if rec.current_doh > 2030 then
update adp_service_dates71608 set to_date(to_char(t.current_doh,'ddmmyyyy')-100, 'ddmmyyyy')
where current of cur;
dbms_output.put_line(' updated');
else
dbms_output.new_line;
end if;
end loop;
end;
when I run it I get erro like
ORA-06550: line 11, column 6:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. ( ) , * % & | = - + < / > at in is mod remainder not range
rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or
like LIKE2_ LIKE4_ LIKEC_ as between from using || multiset
member SUBMULTISET_
The symbol ")" was substituted for ";" to continue.
ORA-06550: line 13, column 57:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
ORA-06550: line 13, column 99:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
, * & - + / at mod remainder rem <an identifier>
<a double-quoted delimited-identifier> <an exponent (**)> as
from into || multiset bulk
what error?
thanks

I formatted it for you:
declare
    cursor cur is
        select current_doh
        from   adp_service_dates71608
        for update of adp_service_dates71608.current_doh;
        rec cur%rowtype;
begin
    for rec in cur loop
        dbms_output.put ( to_char (rec.current_doh );
        if rec.current_doh > 2030 then
            update adp_service_dates71608
            set to_date(to_char(t.current_doh,'ddmmyyyy')-100, 'ddmmyyyy')
            where current of cur;
            dbms_output.put_line(' updated');
        else
            dbms_output.new_line;
        end if;
    end loop;
end;Check the number of opening and closing brackets in the dbms_output.put statement. Also, the syntax of UPDATE is
UPDATE sometable SET somecolumn = somevalue WHERE ...Also "rec cur%rowtype;" is not needed or used. The Cursor FOR loop construction implicitly declares its own, and the one you declared at the top is ignored.
Message was edited by:
William Robertson

Similar Messages

  • How to delete or Update the data in the MEAN table

    Hello Gurus,
    I would like to delete or update the data in the MEAN table...how to do it.
    Precisely I would like to change the status of Main EAN Indicator (field HPEAN).
    Kindly let me know ??
    Rehards
    Senthilll

    programmatically, you may use [BAPI_MATERIAL_SAVEDATA|https://www.sdn.sap.com/irj/scn/advancedsearch?query=bapi_material_savedata&cat=sdn_all] [EAN|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_material_savedata+ean&adv=false&sortby=cm_rnd_rankvalue]
    Regards,
    Raymond

  • Update the data in user-defined table

    Dear All,
    Is there anyway we can insert / update the data in user-defined table in a batch instead of update it from the interface one by one? Our customer has 1,000+ data need to be imported.
    They are on SAP2007A SP00 PL45, SQL 2005, CA localization. Thanks a lot.
    Regards,
    yuka

    Dear Yuka,
    If it is UDT, you may use any SQL query to insert, update it. It is not under SAP support anyway.
    Thanks,
    Gordon

  • How to change the data type in the table ESLL for the field USERF2_NUM ?

    Hello Friends,
    I have a requirement in which one of the change is to convert the data type of the field 'USERF2_NUM' in the table 'ESLL'  from 'QUAN' to 'CHAR'. 
    How do i do it if i have an access to change it..........i think i should also check the impact of the change if done.
    Kindly tell me as my requirement starts with this small change.
    Regards,
    Rajesh Kumar

    Thanks for the reply Sowmya.
    I would like to know 2 things.
    1. Is it ok to change the data type of the field 'USERF2_NUM '  which is in the table ESLL. from quan to char.
    2.  The table ESLL  already has entries. if we change the data type from QUAN to CHAR what is the  effect on the existing entries of the table .
    Kindly reply me back.
    Thanks & Regards,
    Rajesh Kumar

  • Querying the data type of a table/view

    Is there a sql statement that will 'return' the data type of a specified table/view?
    For instance column x of table y has data type int, is there a statement such as:
    SELECT data_type FROM y WHERE column_name = 'x'
    I know the above won't work but it gives the gist of what I am looking for.

    SQL> select table_name, column_name, data_type, data_length, data_precision, data_scale
      2  from user_tab_columns
      3  where table_name = 'EMP';
    TABLE_NA COLUMN_N DATA_TYP DATA_LENGTH DATA_PRECISION DATA_SCALE
    EMP      EMPNO    NUMBER            22              4          0
    EMP      ENAME    VARCHAR2          10
    EMP      JOB      VARCHAR2           9
    EMP      MGR      NUMBER            22              4          0
    EMP      HIREDATE DATE               7
    EMP      SAL      NUMBER            22              7          2
    EMP      COMM     NUMBER            22              7          2
    EMP      DEPTNO   NUMBER            22              2          0
    8 rows selected.
    SQL> desc emp
    Name                                      Null?    Type
    EMPNO                                     NOT NULL NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                             NUMBER(2)
    SQL>Message was edited by:
    Jens Petersen

  • How to find the Column data type changes in table

    Hi All,
    I need to find out the column data type changes where made recently in table .
    How do i check past changes in column data type. Any data dictionary are there to find out the data type changes in the column .
    Thanks in advance..

    <FONT FACE="Arial" size=2 color="2D0000">
    You have the answer on hand (user_arguments / all_arguments)!
    SQL> desc user_arguments
    Name                                      Null?    Typ
    OBJECT_NAME      VARCHAR2(30)
    PACKAGE_NAME     VARCHAR2(30)
    OBJECT_ID     NOT NULL NUMBER
    OVERLOAD       VARCHAR2(40)
    ARGUMENT_NAME  VARCHAR2(30)
    POSITION       NOT NULL NUMBER
    SEQUENCE       NOT NULL NUMBER
    DATA_LEVEL     NOT NULL NUMBER
    DATA_TYPE      VARCHAR2(30) --> Data Type
    DEFAULT_VALUE  LONG
    DEFAULT_LENGTH NUMBER
    IN_OUT         VARCHAR2(9) -->Argument direction (IN,OUT,or IN/OUT)
    DATA_LENGTH    NUMBER
    DATA_PRECISION NUMBER
    DATA_SCALE     NUMBER
    RADIX          NUMBER
    CHARACTER_SET_NAME VARCHAR2(44)
    TYPE_OWNER         VARCHAR2(30)
    TYPE_NAME          VARCHAR2(30)
    TYPE_SUBNAME       VARCHAR2(30)
    TYPE_LINK          VARCHAR2(128)
    PLS_TYPE           VARCHAR2(30)
    CHAR_LENGTH        NUMBER
    CHAR_USED          VARCHAR2(1)
    Look for Data_Type where IN_OUT say OUT. That will be the data type retruned by that function.
    Edited :
    or POSITION in argument list,or null for function return value
    -SK
    </FONT>

  • Data types in internal tables.

    Examples for LINE & KEY.

    Mithun,
    Internal Tables as Data Types
    Internal tables and structures are the two structured data types in ABAP. The data type of an internal table is fully specified by its line type, key, and table type.
    Line type
    The line type of an internal table can be any data type. The data type of an internal table is normally a structure. Each component of the structure is a column in the internal table. However, the line type may also be elementary or another internal table.
    Key
    The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify whether the key should be UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.
    If a table has a structured line type, its default key consists of all of its non-numerical columns that are not references or themselves internal tables. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty.
    The user-defined key can contain any columns of the internal table that are not references or themselves internal tables. Internal tables with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember this, for example, if you intend to sort the table according to the key.
    Pls. reward if useful

  • Updating custom data types

    I've updated a custom data type and redeployed my component; however, I'm not seeing the update take.  What do I need to do to see the update?  Restart the server?
    Thanks
    Dan Stremkowski
    Thrivent Financial

    Hi there,
    you can use your own classes as service method argument or return type. But you should not forget to do a type mapping on both the service and client side.
    I can tell you, how I am sending and receiving my own datatype called "FileBean" which is a simple JavaBean with getter() and setter() methods for the properties.
    I'm using axis for deployment and tomcat as the web server, where my service runs on (currently only local but in future this will be remote).
    Service class: "InstallationService.java"
    Bean class: "FileBean.java"
    Client class: "FileSaving.java"
    My deploy.wsdd file has the following entry:
    <beanMapping qname="myNS:FileBean"
      xmlns:myNS="http://packageDelarationBackwards"
      languageSpecificType="java:packageDeclaration.FileBean"/>
    ...The method header in my service:
    public FileBean storeAttachments(FileBean file)The important part of my Client:
    QName qnFileBean = new QName("http://packageDelcarationBackwards", "FileBean");
    call = (Call) service.createCall();
    call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
    call.setOperationName(new QName("InstallationService","storeAttachments"));
    call.setReturnType(qnFileBean);
    call.registerTypeMapping(
                            FileBean.class,
                            qnFileBean,
                            new BeanSerializerFactory(FileBean.class, qnFileBean),
                            new BeanDeserializerFactory(FileBean.class, qnFileBean));
    ....After deploying the service and starting the server I can send my "FileBean", work with it and give it back.
    Hope this helped. If you need more information, just let me know.
    Steffi

  • Update Sales data in equipment fileds (Table ILOA)

    Hi
    we are issuing delivery for consignment equipment (material with serial number) to customer, movment type 631/632.
    While doing so, the equipment is update with relevant business partner, and it's status is ECUS ESTO,
    But the sales data of this equipment isn't updated in ILOA.
    Can someone  tell me if there is some cutomizing way to set Sales data (Sales org, Sales office, Distribution channel) in equipment when issuing consignment delivery to a customer.
    Thanks in advance
    Guy

    Hi Yuri
    I am having the same reuirement as yours..
    Have you got any solution?? please share!
    Regards.

  • To put Data type inside a table of Microsoft Access (dummy ask)

    Hi to all,
    I am new to use database in java ... (but I did it long time in Visual Basic) and I have a trivial problem...
    I try this SQL statement in different why without success...
    int clientIdKey = 3;
    Date = regneDate new Date();
    "INSERT INTO myTable (idCli, dateReg) VALUES (" + clientIdKey + ", #" + regneDate + "# )";
    The message error I get in this case is the follow:
    "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression '#Sat Oct 20 16:54:23 PDT 2007#'".
    (I tried to format the value of regneDate in different why too... but it was not good the same...)
    I know the mine is a stupid problem .., but I am not going to get the right road, so I ask to some one that it know the whay to say it me please...
    Thank you very much
    regards
    tonyMrsangelo

    Joe's correct. Do it like this:
    int clientIdKey = 3;
    Date regneDate = new Date();
    String sql = "INSERT INTO myTable (idCli, dateReg) VALUES(?,?)";
    PreparedStatement stmt = null;
    try
        stmt = connection.prepareStatement(sql);
        stmt.setInt(1, clientIdKey);
        stmt.setDate(2, regneDate);
        int numRowsAffected = stmt.executeUpdate();
    catch (SQLException e)
        e.printStackTrace();
    finally
        try { if (stmt != null) stmt.close(); } catch (SQLException e) {}
    }    %

  • How to list column names and data types for a given table using SQL

    I remember that it is possible to use a select statement to list the column names and data types of databaase tables but forgot how its done. Please help.

    You can select what you need from DBA_TAB_COLUMNS (or ALL_TAB_COLUMNS or USER_TAB_COLUMNS).

  • A field is given data type is Table icon in Function Module

    Hi Experts,
    I am developing HCM Reports for that I have one Function Module to retrive data from Source.
    One of my Requirement is to Display One of the fields below
    Field Name:
    Sucessfull Candidate
    Vijay
    Raju
    Ram
    to display like this in my Function Module this fields Data Type is selected Table Icon
    I think because of this the field Sucessfull Candidate is not display in Data Sources.
    quires:
    1. what is the procedure to get data in Reporting like above requirement.
    2. what I will do to appairing the field in Data sources
    3.any changes in Function Module
    Regards
    Vijay

    thanks for all participants

  • Date types update

    Dear CRM Guru,
    I have a requirement to update custom date types and an indicator. When a customer should receive an e-mail notification based on service ticket status (either ticket is open or close). When a user sent e-mail to contact person, the date types need to be updated. How I can accomplish this remedy? Your response is appreciated.

    Hi,
    Are you planning to send the e-mail using the action profile?
    If so, in the method that sends the e-mail maybe you can change it to calling a function that executes these changes in the document.
    Regards,
    Susana Messias

  • Need to update a single column in a table with some other column value

    Hi experts,
    I was about to change one column data type in a table. Then I renamed that column name to "old_column_name" . Later I added new column name with required datatype( My case its NCLOB). Now I want to update the new column value with old column value.I mean i have to copy the data. But data amount is very huge. Its more than 1.5 crores of data. But on promote day, I have only 1 hr of outage. Please suggest the effective solution to achieve this.

    Hi Stew
    I have 1 primary key in my table and 11 foreign keys in my table.there are 20 check constraints as well.
    If i go for an online redefine of a table, these objects will be created back automatically?
    Please clarify.
    This is my table. Here Remarks is the column with CLOB datatype. To support multi language, I need to change it to NCLOB. That column having data so i cant rename it.
    So I added new column , after renaming that remarks to old_remarks. Now new column remarks is ready with NCLOB data type, but no data in it.
    To copy the old remarks column into new remarks column, i thought to write one script. But how it is achievable using "DBMS_REDEFINITION". Please explain me,
    create table XXXXXXXXXX
    ID NUMBER(8),
    COMPLETED_DATE DATE,
    COMMUNICATION_MEDIUM VARCHAR2(32),
    REMARKS1 VARCHAR2(4000),
    COPY VARCHAR2(1),
    IO_MARKER VARCHAR2(3),
    EVENT_DATE DATE,
    CON_REF_NO NUMBER(8),
    DEP_CODE VARCHAR2(6),
    SFM_STAFF_NO NUMBER(8),
    CRPD_ID NUMBER(8),
    CRPD_ID_COPY NUMBER(8),
    STATUS VARCHAR2(2),
    COMEBACK_NO NUMBER(2),
    ADD_ADD_ID NUMBER(10),
    AEV_ID NUMBER(8),
    OLAY_ID NUMBER(8),
    COE_TYPE VARCHAR2(3),
    CET_CODE VARCHAR2(6),
    DEP_CODE_RAISED_BY VARCHAR2(6),
    SFM_STAFF_NO_RAISED_BY NUMBER(8),
    USR_CREATED VARCHAR2(30),
    CREATED DATE,
    USR_CHANGED VARCHAR2(30),
    CHANGED DATE,
    EXT_REF_ID VARCHAR2(150),
    REPLY_EXPECTED_DATE DATE,
    SEC_ID VARCHAR2(8) not null,
    PROTECTED VARCHAR2(1),
    APPROVED_BY NUMBER(8),
    DOCUMENT BLOB,
    OLD_REMARKS CLOB,
    CTS_ID NUMBER(8),
    MESSAGE_STATUS VARCHAR2(4),
    WORD_DOCUMENT NCLOB,
    REMARKS NCLOB
    Edited by: Hema on Jul 2, 2012 8:31 AM
    Edited by: Hema on Jul 2, 2012 8:31 AM

  • Data Modeler : Modifying the Table Report layout

    Hi ,
    I'm using SQL Data Modeler (DM) 4.0 EA .
    I used the File -> reports option to generate the reports on Table and in the report
    1) I couldn't see the column data type ? (Refer below table ) , Is there any options to bring on the Data Type in the Report ?
    No
    Column Name
    PK
    FK
    M
    Data Type
    DT
    kind
    Domain Name
    Formula
    (Default Value)
    Security
    Abbreviation
    1
    ID1
    P
    Y
    (10)
    LT
      2
    ID2
    F
    Y
    (10)
    LT
    3
    ID3
    Y
    (1)
    LT
    4
    ID4
    Y
    (10)
    LT
    5
    ID5
    F
    (20,4)
    LT
    2) In options to manage the Table report (Reports -> Manage). Currently I can only remove a heading (like Descriptions Notes ,columns,column comments.). Is there is any way to customize the report in such a way that I can remove some columns (mostly the empty ones) from the report and add the column comments along with the column table than a new column comments table.
    Please let me know  ,is there is an option to customize the report .
    Note: I even tried generating the report using the search then report , but it doesn't give a complete report (i was only able to generate a report on column or table name or constraints , not all together.)
    Thanks,
    Srinivasan.K

    Thanks for the immediate reply.
    I checked on the DM again, the report comes good for the one which has the data type . But now all my data type changed to UNKNOWN and lokks like ,due to this my table report is coming without the "Data Type".
    Can you please help me in fixing this unknown data type issue ?
    Table report for the ones with proper Data type:
    Columns
    No
    Column Name
    PK
    FK
    M
    Data Type
    DT
    kind
    Domain Name
    Formula
    (Default Value)
    Security
    Abbreviation
    1
    ID1
    Y
    NUMERIC (10)
    LT
    2
    SCRIPT
    Y
    VARCHAR (1024)
    LT
    3
    UPGRADE_S
    Y
    VARCHAR (10)
    LT
    4
    UPGRADE_D
    Y
    VARCHAR (250)
    LT
    5
    UPGRADING_F
    Y
    VARCHAR (20)
    LT
    6
    TIMESTAMP2
    Y
    Timestamp
    LT

Maybe you are looking for