Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Sunday, 29 October 2017

Modify Column in Oracle Table


Used to change the data type of existing column
Syntax:
          Alter table <table_name> modify <col  datatype>;
Example:
ALTER TABLE student MODIFY name VARCHAR2(50);
ALTER TABLE student MODIFY (name VARCHAR2(100), email VARCHAR2(100));
Note: To reduce the data type size, it will support only on empty table
Share this article :

2 comments:

  1. Hello Mate,


    In debt to you for making my learning on the Modify Column in Oracle Table area so hassle-free! I lay my faith on your writings.

    I am facing the below issue(Screen shot) with CREATE_JOB procedure. The issue is with CREDENTIAL_NAME attribute.

    More information on this:

    I tried to create the job for one of the predefined chain.


    why I am using CREDENTIAL_NAME attribute is, in one of the chain step I am calling LINUX script.

    I read multiple articles and watched many videos about how to use this tool - and was still confused! Your instructions were easy to understand and made the process simple.


    Many Thanks,

    ReplyDelete
  2. Halo,


    Fully agree on Modify Column in Oracle Table . We’re seeing a lot of projects tackle big complex problems but few seem to have taken into consideration and in particular reasons to adopt.

    Currently I'm trying to make a test using create job as a way to have multiple process on database starting in a loop.
    Basically I'm getting different behaviors when testing on
    different database machines. I'll define the machine names are A and B.
    If I started running the anonymous block below in the machine A for a loop to create 3 multiple jobs, is working fine, i.e, the create job using enabled parameter, created the job and automatically start:
    DECLARE
    L_job_name VARCHAR2(100);
    L_comments VARCHAR2(240);
    L_pls_block VARCHAR2(32000);
    L_thread NUMBER := 1; -- count of jobs
    L_max_threads NUMBER := 3; -- max number of jobs to be started
    L_lot_id NUMBER := 1234; -- add any number just to represent a lot
    BEGIN

    while L_thread <= L_max_threads loop
    ---
    L_job_name := 'job_' || L_lot_id || L_thread;
    L_comments := 'Job test ' || L_lot_id || ' and thread ' || L_thread;
    L_pls_block := 'BEGIN logger.log(''job running of thread' || L_thread || '''); END;';
    ---
    dbms_scheduler.create_job(job_name => L_job_name,
    job_type => 'PLSQL_BLOCK',
    job_action => L_pls_block,
    start_date => SYSTIMESTAMP,
    comments => L_comments,
    enabled => true);

    --DBMS_SCHEDULER.RUN_JOB(L_job_name, TRUE);

    L_thread := L_thread + 1;
    end loop;
    END;
    /

    but if I start the same code in the machine B, nothing is happening and I need to uncomment the line about DBMS_SCHEDULER.RUN_JOB(L_job_name, TRUE);

    I did another test in the same machine B using enabled FALSE when creating the job and during the call from DBMS_SCHEDULER.RUN_JOB changed to false in the user_credentials but only one job runned, i.e, the result was logged from just one job, instead of the 3 jobs that had most be created.

    Do you have an idea about what I need to look? Is there something related about database setup, credentials that I need to take a look?








    It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
    Keep up the good work!



    Thank you,
    Ajeeth

    ReplyDelete