Change the 'Date' of a column in A table, the new column in the Table b:

I'm trying to pull a TABLE_A Date and change the year at a date and popluate it into a new table. I would also like to put on the KP to TABLE_A, so that I can create a link to the master record.

In my example I use SYSDATE to my current date. Once I get the script working, I want to shoot the Calander_Date of my "current schedule" by their SUMMIT.

1 INSERT INTO TABLE_B (NAME_ID VALUES, Date, New_Date ())
2 NAME_ID, (it is a column OF TABLE_A).
3. DATE, (it's also a TABLE_A Colum)
4 TO_CHAR(DATE,'DD') | » -'||
5 TO_CHAR(DATE,'MON') | » -'||
(6 TO_CHAR(SYSDATE,'YY'))
7. FROM TABLE_A
8. WHERE TO_CHAR(DATE,'MON') = TO_CHAR (SYSDATE, 'MY');

Needless to say that it does not work! I am very new to SQL and APEX. I tried also incorporate some INSTRUCTIONS SELECT, as shown below, but even now of (trying to figure out out to calculate the TO_CHAR FROM DUAL and TABLE_A for the "DATE" column)

1 INSERT INTO TABLE_B (NAME_ID VALUES, Date, New_Date ())
2. SELECT NAME_ID IN THE TABLE_A,
3. CHOOSE DATE TO TABLE_A,
4. SELECT TO_CHAR (DATE, 'DD') | » -'||
5. SELECT TO_CHAR(DATE,'MON'). » -'||
6. SELECT TO_CHAR (SYSDATE, 'YY')) OF
7. BASED ON NAMES
8. WHERE TO_CHAR(DATE,'MON') = TO_CHAR (SYSDATE, 'MY');

According to the changes I I usually get the following two errors:

ORA-0933: SQL command not properly ended (in the first example)
ORA-00936: Missing Expression (in the second example).

Appreciate all the thoughts that you all might have.

LEONHARK

Oh, and I forgot to mention, special attention for the day/month/year. The examples I cited are for digital day/month/year. If they are stored at May 1, 2008, replace the "MM" above "LUN."

Good luck!

Tags: Database

Similar Questions

  • Changes of data type of column between the local and remote database

    Please point me the proper documentation, so I can understand what is happening.and how to solve the problem in the short term until we can change the database character set to match the remote database.

    Details:

    Remote database: set of 12 c CARS characters AL32UTF8

    Database local 11g 11.2.0.4 as UTF8 character.

    CREATE TABLE local_table_t AS (SELECT NAME FROM reference_table_t@remotedb)

    the NAME column in reference_table_t to remotedb is varchar2 (10 byte), it creates this column in local_table_t as varchar2 (30 bytes)

    CREATE TABLE local_table2_t AS (SELECT NAME FROM reference_table2_t@remotedb)

    the NAME column in reference_table_t to remotedb is varchar2 (10 char), it creates this column in local_table_t as varchar2 (30 char)

    This same problem also happens with views materialized from the remotedb.

    Thank you

    Dave.

    Found note size double or triple column when using (materialized) views / DEC in a db AL32UTF8 and the dblink pointing to a non-AL32UTF8 db (or vice versa). (Doc ID 1592514.1)

    that answers my question.

    Dave.

  • traditional measures to change a data type of column

    Hi guys,.

    I need your opinion on the traditional way to edit a column of data type, which is the best in terms of performance, taking into account millions of rows to be updated.
    We use the Oracle Database 11g Release 11.1.0.7.0 - 64 bit

    1. create the new column at the end of the table.
    2. run an update to populate the new column in the table
    3. remove the old column of table
    4 rename the new column for the original name of the column

    or

    1. create the new column at the end of the table.
    2. run an update to populate the new column in the table
    3 Rename the new column for the original name of the column
    4. remove the old column of table

    Kind regards
    Zack

    Welcome to the forum!

    Unfortunately, you posted in the wrong forum. This forum sql developer and your question belongs in the database - forum general question that the issue has nothing to do with the sql developer. As the forum title says "SQL Developer (not for general questions of SQL/PLSQL)".

    1. open a new thread in the General database forum.j
    Database General Discussions

    2. change this question to post the link to the new question and ask people to follow.

    3. Mark this question ANSWER so people will follow in the other forum

    If your question is to choose between the first choice that actually works
    >
    1. create the new column at the end of the table.
    2. run an update to populate the new column in the table
    3. remove the old column of table
    4 rename the new column for the original name of the column
    >
    or the second choice that cannot possible work?
    >
    1. create the new column at the end of the table.
    2. run an update to populate the new column in the table
    3 Rename the new column for the original name of the column
    4. remove the old column of table
    >
    You cannot rename the new column for the original column name (step #3) because this would have two columns with the same name. And you can move the old column of table (step #4) because you can never do step #3.

    What did you think?

    When you post in the other forum, you must provide the data types of the two columns involved: the old and you want to take it.

    If you can do it offline you can use a DEC (create the select table) to create a new table that contains the new column and data and does not include the data or the old column. Who would make the best because it could make the new table NOLOGGING and create the table and data in parallel.

  • When I try to change the interactive report columns, then triggers the error: "unable to change column attributes. "ORA-01403: no data found. Pls tell me why?

    When I try to change the interactive report columns, then triggers the error: "unable to change column attributes. "ORA-01403: no data found. Pls tell me why?

    You use listener EA3 ADR?

  • Add/change the columns of data type (scripting)

    Hello

    I am writing a script to add default columns and their values in tables. So far, for me, it is possible to add columns to an existing table in the model.

    Then, I want to add value to the data type. I discovered there is a method called getDataType(). So far, I have not found the "setter; for this property.

    Like other scripts, I started by creating a table with columns, and then using the API to read the values.

    A simplified version of my code:

    get the columns of table

    myTab var = model.getTableSet () .getByName ("T_POSITIONS");

    colArray = myTab.getElementsCollection () .toArray ();

    loop through columns

    for (i = 0; i < colArray.length; i ++) {}

    the type of var data = colArray [i] .getDataType ();

    model.getAppView () .log (colArray [i] + "a datatype" + dataType);

    colArray [i] .setDataType ("VARCHAR2 (1)");

    }

    An error occurs when I want to run this script: could not find setDataType function in the object ID.

    I can't find the right method to add/change the datatype property.

    Any information would be appreciated.

    Hi Bart,.

    Here's what's in the column in the XML file:

    
    FDB11R21
    EMPLOYEES
    FIRST_NAME
    
    2015-01-13 12:45:08 UTC
    First name of the employee. A not null column.
    HR_870
    true
    false
    1
    LOGDT024
    20 BYTE
    false
    
    

    20 BYTES

    If you need set the size in "20 BYTE" or "20 CHAR".

    Philippe

  • script to change the data type of column

    Hi gurus of the oracle.

    I have 190 tables in my database.

    I have the column type CHAR of all these tables data.

    I need to change the data type of CHAR in VARCHAR2 for all these tables...

    There the script to change the data type of all tables at once?

    Please help me in this regard.

    Thanks in advance

    Concerning

    REDA

    Hello

    There is nothing built-in to Oracle SQL to do.  Maybe your front-end has certain characteristics.

    You can write dynamic SQL statements to do.  In other words, you can write a query that the output is a SQL script like this:

    ALTER TABLE TABLE_A CHANGE (A_TXT1 VARCHAR2 (5))

    A_TXT2 VARCHAR2 (10));

    ALTER TABLE TABLE_B CHANGE (B_TXT1 VARCHAR2 (5));

    with one row for each column of type CHAR.  Notice how the first line of output for each table begins with ALTER TABLE... but the later lines at the same table.  Similarly, the last line of a table (which will be the same as the first row, if the table has only one column of type CHAR) to end with a semicolon, but other lines are not.

    Here's a way to generate and execute such a dynamic script in SQL * more:

    -Disable the features that make the output easy to read, but hinder the execution
    SET FEEDBACK OFF
    SET LINESIZE 500
    SET PAGESIZE 0

    -Create fix_char.sql
    COIL c:\some_pathename\fix_char.sql

    SELECT THE CHECK BOX
    WHEN ROW_NUMBER () OVER (PARTITION BY table_name
    ORDER BY column_name
    )  = 1
    THEN 'ALTER TABLE ' | table-name
    || "CHANGE (").
    ELSE «»
    END
    ||        column_name
    ||        "VARCHAR2 (').
    ||        DATA_LENGTH
    ||        ')'
    ||        CASE
    WHEN ROW_NUMBER () OVER (PARTITION BY table_name
    ORDER BY column_name DESC
    )  = 1
    THEN '); "
    Output END AS
    Of user_tab_columns
    WHERE data_type = "CHAR".
    ORDER BY table_name
    column_name
    ;

    SPOOL OFF

    -Turn on the features that make the output easy to read, but hinder the execution
    SET FEEDBACK ON
    SET LINESIZE 80
    SET PAGESIZE 50

    -Fix_char.sql performance
    @c:\some_pathname\fix_char

    It's good to change all the CHARIOT of VARCHAR2 columns.  The CHAR data type is nothing trouble.

  • change the data type of column in a view

    Hi gurus,

    Please suggest.


    I have been created as below in the region of production.

    CREATE OR REPLACE TYPE PROD. (OBJECT) ACE FEATURE_CUSTOM_LIST_OBJ
    TERMINAL_FEATURE_ID NUMBER (8).
    DATA_VALUE NUMBER (8)
    );
    /


    And the view is created below the base have the PROD. FEATURE_CUSTOM_LIST_OBJ

    CREATE OR REPLACE FORCE VIEW PROD. TERMINAL_FEATURE_TYPE
    (
    TERMINAL_FEATURE_ID,
    DATA_VALUE
    )
    AS
    SELECT
    TERMINAL_FEATURE_ID,
    DATA_VALUE
    TABLE)
    CAST)
    PROD. TERM_RELATED_REF_DATA. GET_TERMINAL_FEATURE_TYPE AS PROD. FEATURE_CUSTOM_LIST_TAB));

    Examples of data must be inserted into the display

    TERMINAL_FEATURE_IDDATA_VALUE
    120
    121
    123
    11THERE
    11N

    If iam thinking is possible that we can change the data type of number of varchar2 data type column in a view?

    Or should I follow create or replace type as whenevr the nonnumeric data tries to bring into view
    sound by giving the number plsql for digital character conversion error since it is a number of data type here.

    I have been created as below in the region of production.

    CREATE OR REPLACE TYPE PROD. (OBJECT) ACE FEATURE_CUSTOM_LIST_OBJ

    OK - but it is a SCALAR - not a collection object

    And the view is created below the base have the PROD. FEATURE_CUSTOM_LIST_OBJ

    CREATE OR REPLACE FORCE VIEW PROD. TERMINAL_FEATURE_TYPE

    No - it isn't. Your type of object is a SCALAR - not a collection. You need create a view on a table or a collection that is treated as a table.

    DDL perspective you posted doesn't even mention your FEATURE_CUSTOM_LIST_OBJ.

    If iam thinking is possible that we can change the data type of number of varchar2 data type column in a view?

    Have you tried using TO_CHAR to format the number as a string?

  • Change the length of a Table column (CHAR data type)

    Hi gurus,

    SQL > select * from version $ v

    BANNER

    ----------------------------------------------------------------

    Oracle Database 10g Release 10.2.0.3.0 - 64 bit Production

    PL/SQL version 10.2.0.3.0 - Production

    CORE Production 10.2.0.3.0

    AMT for Linux: release 10.2.0.3.0 - Production

    NLSRTL Version 10.2.0.3.0 - Production

    I need to increase the length of a CHAR of a table data type column (currently it's tank (3) and you want to change to char (4)). Here are more details on the table:-

    • Contains more than 20 million lines.
    • Table contains several indexes.
    • Table is referenced by several tables (about 60 tables) and it refers to several tables (about 3)
    • Table has 4 complex triggers. Triggers call procedures and packages.

    What I've tried so far


    1 disabled all triggers and ran ALTER statement to increase the length. It took hours and did not finish in a reasonable amount of time, even if no error, but it took more than 12 hours.

    2 tried DBMS_REDEFINITION package but it does not work with the standard version of Oracle 10 g.

    I think to try next

    I think same Optics:

    Say my name of the existing table is OLD_T1 where the length of column need to increase

    -Create a copy (with increased column length) table of OLD_T1, Say NEW_T1

    -Move data from in OLD_T1 to the new table NEW_T1

    -Lower OLD_T1 (or rename it to OLD_T1_TMP)

    -Rename NEW_T1 to OLD_T1

    -Create all indexes, triggers, constraints etc..

    I wish to confirm, if my approach is correct? Or someone has a better idea to do this?

    Please note: I know that the CHAR data type gives the problem but it is an old system and I don't have authority to change the design of database.

    Appreciate any comment/suggestion

    Thanks in advance

    > I mean, can any application break if it depends on fixed-length?

    Yes, because the code can be expected completed on the right areas.

  • Update the column values with the new user who has changed the data in the current line

    I have a table, the following structure.

    CREATE TABLE FILTERCALENDAR1
    (DATE OF THE "C_DATE',
    NUMBER (1,0) 'DAY_OF_WEEK ',.
    NUMBER (1.0) "WEEK_WINDOW."
    NUMBER (1.0) "MONTH_WINDOW."
    NUMBER (1.0) "YEAR_WINDOW."
    NUMBER (1.0) "DATE_YEAR_WINDOW."
    NUMBER (1.0) "ONCE_WINDOW."
    VARCHAR2 (25 BYTE) "USERNAME."
    "LASTUPDATED" DATE
    );

    Problem:
    If a user changes the value of one of the columns I want to write his name to user and sysdate in the 'USERNAME' and LASTUPDATED' columns.

    * Tried: *.
    I tried an update trigger for this problem, but I get an error table mutation.

    The one you suggest how can I achieve this.

    Concerning

    Use BEFORE the UPDATE trigger

    CREATE OR REPLACE TRIGGER myTrigger
    before UPDATE ON FILTERCALENDAR1 FOR EACH ROW
    BEGIN
    :new.USERNAME := user;
    :new.LASTUPDATED := sysdate;
    END;
    
  • Cannot change the type of data in the columns referenced by foreign keys

    Hello:

    I'm using Version 3.1.0.691 and change the types of data in many columns of data derived from the field types. If a column is referenced by a foreign key, however, the data type radio buttons are grayed out. I suppose that if I deleted the foreign key, that I would be able to change the data type of the column to a field, but that would be tedious. Is there another way to go about this?

    Any help would be greatly appreciated.

    Thank you

    Doc

    Hi Doc,

    If a column is referenced by a foreign key, however, the data type radio buttons are grayed out.

    It is not good - if you have the PK column, and it is called by another FK column you can change the data type of column PK and FK column data type will follow the change. You cannot manually change the data type of column FK. Good column PK itself could relate to another column, and in this case you cannot change the data type of column PK.
    In your case - you need to find the first PK/Uk column that is not the column FK itself and change its data type. FK columns in the chain will follow.

    Philippe

  • change the column type of data in large tables

    Hello

    I have a very large table 3 TB and 97 scores and I need to extend the size of a column. This operation can take a long time and I'm afraid that it will block some SQL operations. What is the recommended way to do this? Can I use alter column? Should I add the column, copy values, delete the former and rename it?

    Kind regards

    Nestor Boscan

    Because you widen the column, all existing values are guaranteed to fit the new size. This should happen fairly quickly. If you were however decrease the size of a column, each value must be checked first before the DOF could complete to check it might all go in the smaller space. Change the alter table is a great value.

    If these fields are variable length (number, varchar2), then the space doesn't have to be 'reserved' for future data. Oracle will take care of the future inserts or updates of larger data as usual. If you increase a fixed length as a CHAR data type, then it is another story.

  • Edit/view (data or Table column) value - cannot change the data, but it can be updated

    Hello

    According to the help of Oracle SQL Developer Center, the dialog ' Change/see value (data or Table column)' should "change the value of data" if we "are allowed to change the data." We strive to use this dialog box to modify/update data without having to write an Update statement, but is not to leave us. Us are not allowed to update the data, we can update via update statements. Even as the owner of the schema.table, it don't will change us the value in the dialog box "Edit/see value (data or Table column).

    Any ideas?

    We are on SQL Developer Version 3.0.0.4 build HAND - 04.34 and Oracle 11 GR 1 material (11.1.0.7) database.

    Thank you

    Alex Larzabal.

    You can still vote on the existing demand for this developer SQL to add Exchange of weight for implementation as soon as possible:
    https://Apex.Oracle.com/pls/Apex/f?p=43135:7:3974986722753169:no:RP, 7:P7_ID:4902

    Kind regards
    K.

  • How can I change the Date format column

    Hello

    How do I change a column to the format of the DATE where that particular column is seen text currently

    Can someone suggest me please...

    ASY allows you table1 with x varchar2 field and you want to convert it to this day

    1 alter table table1 add y.

    2 update table1 set y = to_date(x,'dd-Mon-yyyy'); the format in which date you stored hav collar x

    3. change the table1 table: remove the x column;

    4. change the table1 table rename column y to x;

    Alexander gelin
    http://nimishgarg.blogspot.com/

  • Change the order of the columns does not cause any data found error report

    Hello. I have a weird problem (and I'm new to APEX). I have a subregion of report that shows the details of a master record based on the ID of the parent area. When I have everything first to change SQL for the query and apply the changes page works fine. When I go back and change the region > attributes report and use the arrows to change the order of the columns the region then returns:

    error report:
    ORA-01403: no data found

    I tried to change the query so that the columns found in the desired order and who has also not returned no data error. If I go back to my original query (which had 2 fewer columns) the page works again. Then I change to the new query (2 addtl columns), and then it works again, until I have change the order of the columns again. Don't know if it would be serious or not, but one of the columns is a 2 columns of the table concat.

    Any ideas would be appreciated, because I'm out of them.

    Thank you!

    use: Apex 4.0
    DB: 10g Exp

    "807428," Hi

    using 4.0 or 4.0.1? Can you reproduce the same problem on apex.oracle.com as well?

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Change the Jpeg file taken time in the "Date" column to windows explorer for modification time?

    I just found out that JPEGs, edited and recorded by CS4 still wear their original creation time in windows Explorer, regardless of how many times they have been modified, which makes it very inconvenient and confusing, without opening the files to find out. Does anyone know how to change the setting to 'Update?' Thank you very much in advance!

    You say that you see the creation Date column in Windows Explorer, but not update?

    If this is the case, it's an easy fix...  In Windows Explorer, right click on the bar with the titles (for example, on the title the creation Date) and check the update box.  Normally the update, this is what is displayed by default Explorer for the elements of the General.  I don't know what is shown for other types of files, I use only general articles.

    What do you see when you follow these steps:

    1. right click on the folder that contains your images (in the navigation to the left).

    2. Select Properties.

    3. click on the Customize tab.

    4 what was the optimize this folder for: of the field?

    FYI, as you can see you can change folder for example, customizing the general articles for one or a whole folder tree.

    You can also make changes to one of your folders of photos, and then propagate the settings to all folders of this type in your system.  I'm really jump coming here; I would like to know if that's what you eventually want to do.

    -Christmas

  • change the color of the data in a column

    Hello experts,

    I'm trying to change the color of the data displayed in a column in function on the condition that it is set to 0, then it should be in red

    I tried the following, but it doesn't work.

    When-validate-item trigger on the level of data block
    if forecast_cnt = 0 then
    
    SET_ITEM_PROPERTY('FORECAST_CNT',foreground_color,'R255g0b0');
    
    end if;
    I'm doing something wrong?

    There is no problem with the code. There is problem with the trigger. WHEN-VALIDATE-ITEM work when there are changes in the field. If you want to the time of the query. Then use the QUERY post at the level of the blocks. If it is multi record block using SET_ITEM_INSTANCE_PROPERTY with Visual attribute.

    -Clément

Maybe you are looking for

  • How can I activate full? (for Pages 5.6.1)

    I don't know if I never noticed this before or if I was doing something without realizing it, but now my computer will not autocapitalize the first letter of each sentence. Is it possible to allow the autocapitalize text in Pages?

  • HP Compaq nc8230 Notebook PC drivers for windows 7

    I can't find the HP Compaq nc8230 Notebook PC drivers for windows 7.  Vista listed but not win 7.  Help, please.

  • How to hide the window "current calls.

    Whenever I reduce Skype, I have this next window and cannot be removed. How can I remove it? [Sorry guys. No screeenshot. I cannot download to my computer, can't paste a link of Dropbox, or cloud - he still directs to a web page that is broken, even

  • Satellite 2410 does not start

    Hi allI have a s S2410-304, which worked properly until today.After trying to fix the speaker, I removed all pieces to open Notepad to reach the meachanic parts near the speaker. But I could not remove the upper part of the lower panel and put it all

  • Having trouble with my internet connection through wifi. N600 router is what I think.

    I had some problems with my internet connection recently via my wireless router. I get the little triangle yellow and with the connection at different times and I can't call my local internet provider because it still works when they are open, and th