Need to alter (widen) a varchar column, then add two zeros.

I dug a table of VARCHAR2 column (3) in varchar2 (5)
and I need to update the 945 values that are not null with two zeros.
However, when I widened the column he added 2 spaces on the right

ALTER TABLE source_inspection change)
afs_action_number VARCHAR2 (5)
);
Modified table.


SQL > Select afs_action_number
2 from source_Inspection
3 where afs_action_number is not null;

AFS_A
-----
526
526
525
524
123
523
123
123
WWW
123
521

11 selected lines.

My goal is to increase the column width
Then the lpad/prefix two zeroes to the left of the number.
-to go from 123__ to 00123
How can i:
(1) expand the column and put the spaces to the left?
(2) then add two zeros after enlargement?
(I don't want to change the column varchar2 to a number).

Thank you!

Please explain in detail.

Something like that?

update source_inspection
      set afs_action_number='00'||trim(afs_action_number)
      where afs_action_number is not null

Arun-

Tags: Database

Similar Questions

  • need to trigger when updating a column then sysdate record on another column

    Hello
    Gurus

    I have a table named RTV_PLAN
    And it has two columns,
    FORCE_KEYIN_FLAG VARCHAR (2)
    DATE OF FORCE_KEYIN_DATE

    I want when FORCE_KEYIN_FLAG get a value
    Then FORCE_KEYIN_DATE save the sysdate

    Please kindly give help

    Thank you very much

    Saven

    Florian wrote:
    You can check out what they have another error?

    Relaxation compile? I don't see obvious syntax errors. If you get a compile error, see the error.
    What is the trigger that is supposed to do? It is impossible for anyone to tell you if your trigger does what you want it to do. You would have to tell us what it is supposed to do. Since you have the tables and the application of the APEX in question, you would have to tell us if it does not have what you want in some specific cases.

    Justin

  • Date in varchar column

    Hi all

    my need is to check the validity of the date in the column of type varchar.

    Yes, the architecture of this table is poor, but unfortunately I have no impact here.

    Then, the user can easily insert something like ' 31.04.2013' and I get the error during the conversion from date:

    ORA-01830: date format picture ends before converting all of the input string

    Here is my code:

    Select

    TO_DATE (REGEXP_SUBSTR ('31.04.2013','(0?))) [0-9] | [1-2] [0-9] | 30. 31) [\. / \\\-\,] (0 ? [0-9]|1[0-2])[\./\\\-\,](2[0-9])? (([0-2] [0-9]'), 'jj') arcdate

    of the double

    Please help me understand how do i:

    (1) avoid the error

    (2) returns the text "invalid date" instead of ORA-01830...

    Thanks in advance.

    Issue is the fact that the varchar column values follow a date format? If so, the easiest way is to write a function. Something like:

    create or replace

    function date_check)

    p_date_string varchar2,

    p_format_mask varchar2

    )

    Return number

    is

    date of v_dt;

    Start

    v_dt: = to_date (p_date_string, p_format_mask);

    Return 1;

    exception

    while others then return 0;

    end;

    /

    Now, for example, if the date string format exact follows, you could:

    Select the date_check (your_column, 'dd.mm.yyyy')

    When 1 then your_column | "is a valid date in the exact format.

    of other your_column | 'is not a valid date in the exact format.

    end

    from your_table

    /

    SY.

  • 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?

  • Needs of report to show all columns

    Hello, I have two interactive reports on two different pages, and I'm unable to show all columns. It will automatically appear all the columns. I know that I can show them all with Actions / Select the columns / > >, but I can't expect all of my users to do each time that they reopen the browser. They want that search the IRs without pressing Actions each time.

    In my 1st report, I just a column of money, but it will not appear automatically. How can I get the GAL_PUMPED to automatically display column without using the Actions menu each time?

    SELECT UFT.SITE_NUM, UFT.TANK, UFT.FUEL_TYPE, sum(UFT.GALLONS) GAL_PUMPED
    FROM  futrak.FUEL_TRANSACTIONS  UFT
    WHERE to_char(UFT.TRAN_DATE,'MON-YYYY') < to_char(SYSDATE,'MON-YYYY')
    GROUP BY UFT.SITE_NUM, UFT.TANK, UFT.FUEL_TYPE
     

    In my 2nd report, only columns of fth automatically, will not display the columns of ftd. How all the columns in the two tables to automatically display without the Actions menu each time? Also, the unit is supposed to be the last column, but this problem makes the 3rd column after using select columns. I'm stuck with APEX 4.0 and may not use plugins, but I want to hack everything that will help solve this problem. I'd appreciate any help or advice, thank you.

    SELECT fth.SITE_NUM, fth.TANK, sum(ftd.GALLONS), ftd.FLEET_ID, ftd.EXPENSE_TO_PROJECT, ftd.EXPENSE_TO_TASK, fth.UNIT_NUM
    FROM FUEL_USAGE_HEADER fth,
      FUEL_USAGE_DETAIL ftd
    WHERE 
      fth.FUEL_USAGE_ID = ftd.FUEL_USAGE_ID
    AND fth.PROCESSED_DATE is null 
    AND to_char(fth.TRANSACTION_DATE,'MON-YYYY') < to_char(SYSDATE,'MON-YYYY')
    GROUP BY fth.SITE_NUM, fth.TANK ,ftd.FLEET_ID, ftd.EXPENSE_TO_PROJECT, ftd.EXPENSE_TO_TASK, fth.UNIT_NUM
    order by 1
     

    Display all Columns.png

    Login to your application as a developer when running. Modify the report in the way that your users need. Save the report, select "default report parameters.

  • How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    I have a table whose columns with values such as

    MINNEAŸPOLIS and ¿VV ¿A

    Only the characters that are allowed in this column are alphabets, numbers, spaces, points and supports.

    Please help to write a SQL SELECT with Regexp_like query or any other option.

    Thanks to you all! Under query worked for me. Thank you Frank to explain the concept of hooks inside regexp_like.

    SELECT * FROM testspecial, WHERE REGEXP_LIKE (sampletext, "[^] ^ A - Z ^ a - z ^ 0-9 ^ [^.]") ^ {^} ^]') ;

  • Change the size of text to varchar column (2000) on the CLOB type

    Hello

    Is - this suggestable to change the size of text value VARCHAR column form (2000) use of CLOB property cc.bigtext?

    What are the precautions and other things to consider?

    Thank you
    Sikora

    The document suggests the only real question that comes to East with multibyte characters, which can you leave with one string more than 4 k bytes.

    You should have no problem with the data you have already there.

    The issue would occur if further on the road someone created a field of very large text which was under 4 k characters but larger than 4 k bytes.

    To pass 4000 would be that you have described.

    EDIT - in fact it would be SHUTDOWN, backup, edit the field in the sites and change column on db, starting upwards.

  • With single quotes varchar column

    Hello

    How to extract a varchar column with single quotes in the DB

    For example, I want the result as below

    SELECT id, name of the cust

    1, 'ABC '.

    Kind regards
    Abdul
    select id
          ,''''||name||''''
      from cust
    
  • compare number two, in two tables varchar column

    Hello
    I have two tables with varchar column number.
    SQL> desc ckm1
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     N_COMP_ID                                 NOT NULL NUMBER(10)
     C_COMP_NAME                               NOT NULL VARCHAR2(120)
     C_HOSTNAME                                         VARCHAR2(20)
     N_FRWK_COMP_FLAG                          NOT NULL NUMBER(1)
    C_COMP_ENV                                         VARCHAR2(1024)
    SQL> desc ckm2
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     N_COMP_ID                                 NOT NULL NUMBER(10)
     C_COMP_NAME                               NOT NULL VARCHAR2(120)
     C_HOSTNAME                                         VARCHAR2(20)
     N_FRWK_COMP_FLAG                          NOT NULL NUMBER(1)
    C_COMP_ENV                                         VARCHAR2(1024)
    Is any function similar to 'dbms_lob.compare '...
    Thus, two field of two columns of text in another table can be compared?
    Any example?
    Any advice on this?
    No comment

    Something like that?

    Select t1.n_comp_id, decode(t1.n_comp_name,t2.n_comp_name,'EQUAL','DIFFERENT') EQ_DIFF
    from chm1 t1, chm2 t2
    where t1.n_comp_id=t2.n_comp_id;
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/02/query-gerarchiche/]

  • Example of the need for trival canvas MXML (separate file) then added to a list of WindowedApplication

    Uh, sorry about that, but I am a beginner and I tried to get this working for a few days and can not understand. I can't compile:

    The prefix "mx" for the "mx:Canvas" element is not related.

    I can't understand the Flex namespaces!

    -> Can someone please quickly create a simple MXML component based on canvas that says ' Hello, canvas ', then add to the display list in a master file of the AIR (WindowedApplication)? < -.

    It would be nice to have actually TWO examples: addition to WindowedApplication via MXML and ActionScript (addChild) (< mx:MyCanvas... >, etc.).

    I have five Flex books now and they don't seem to cover how "call" a component custom.  All of the examples create components inside the WindowedApplication (and NOT in a separate MXML file).

    Pete

    MXML:


    http://www.Adobe.com/2006/mxml"layout ="absolute"xmlns:core ="mypackage.*">
        
        

    script:


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" init () ">"
       
           

    Import mypackage. MyCanvas;

    Import mx.containers.Canvas;

    private function init (): void {}

    this.addChild (new MyCanvas ());

    this.addChild (new canvas ());

    }

    ]]>
       

    the mypackage/MyCanvas.mxml file contains:


    http://www.Adobe.com/2006/mxml">
       

  • Group by query, and then add another dimension

    Hello guys,.

    I am facing problem while building a query. In this, I do group first, and then add a column with a condition more.

    I have following data in the table or existing query.

    create table tableA (key number (5), newspaper varchar2 (5), varchar2 (5) Blog, available1 number (10), disponibles2 number (1), Type varchar2 (5))

    Insert into tableA values (100, ' 501 ', ' 1501', 10000, 8000, "T1")

    Insert into tableA values (100, ' 501 ', ' 1501', 12000, 0, 'T2')

    Insert into tableA values (200, ' 502 ', ' 1505', 15000, 9000, "T11")

    Insert into tableA values (200, '502', '1505', 8000, 1000, "T12")

    Insert into tableA values (200, '502', '1505', 5000, 1000, "T13")

    Insert into tableA values (300, ' 503 ', ' 1510', 7000, 6000, "T21")

    Insert into tableA values (400, '503', '1510', 6000, 1000, 'T31')

    I created the 'Difference' on the fly using NVL (available1, 0)-NVL(Revenue2,0) as the difference

    Type of difference key1 journal Blog available1 disponibles2

    100 501 1501 10000 8000 2000 T1

    100 501 1501 12000 12000 T2

    200 502 1505 15000 9000 6000 T11

    200 502 1505 8000 1000 7000 T12

    200 502 1505 5000 1000 4000 T13

    300 503 1510 7000 6000 1000 T21

    400 503 1510 6000 1000 5000 T31

    Desired output

    We must show Type (Sun) only when the difference is high and have to group by (Key1, Journal, Blog) while the rank becomes a.

    It is like showing the first 6 columns first and then add the columns of 'Type' later (probably using subqueries).

    Type of difference key1 journal Blog available1 disponibles2

    100 501 1501 22000 8000 14000 T2

    200 502 1505 28000 11000 17000 T12

    300 503 1510 7000 6000 1000 T21

    400 503 1510 6000 1000 5000 T31

    Any idea or detail will be appreciated.

    Thank you

    Use the DUNGEON:

    Select the key,

    Journal,

    blog,

    Sum (revenue1) available1,

    Sum (revenue2) disponibles2,

    NVL (Sum (revenue1), 0)-nvl (sum (revenue2), 0) difference.

    Max (type) keep (dense_rank last order of nvl(revenue1,0) - type nvl(revenue2,0))

    from tablea

    Key, group

    Journal,

    blog

    order by key,

    Journal,

    blog

    /

    TYPE OF KEY JOURNAL BLOG AVAILABLE1 DISPONIBLES2 DIFFERENCE
    ---------- ----- ----- ---------- ---------- ---------- -----
    100 501 1501 22000 8000 14000 T2
    200 502 1505 28000 11000 17000 T12
    300 503 1510 7000 6000 1000 T21
    400 503 1510 6000 1000 5000 T31

    SQL >

    SY.

  • How do to activate 'VAPP Options' on an existing virtual machine, and then add the properties that will be passed down through the OVF - ENV. XML



    I'm trying to understand vSphere PowerCLI how to activate the "Options of VAPP" on an exsiting VM (in this case a model freshly cloned) then add properties and select cdrom of the FVO data access such as when the virtual machine is running the FVO - env.xml contains the properties in the CD-ROM drive.

    If I use the vSphere client and open the virtual machine settings and click on the tab 'Options' and then select "Options of VAPP" and change the setting to "Enabled" and then select 'VAPP-> Advanced Options' and click on the button 'Properties' on the right, I can add the properties and then I can change them vsphere PowerCLI, but given that these actions are not retained if I clone the virtual machine I need a way to put these in place of vSphere PowerCLI without using the vSphere client to do.

    Thanks in advance for the help!

    Mike

    You can use the vSphere API to activate the 'Options of VAPP"on an existing virtual machine, and set properties. For example:

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.vAppConfig = new-Object VMware.Vim.VmConfigSpec

    $spec.vAppConfig.property = new-Object VMware.Vim.VAppPropertySpec [] (1)

    $spec.vAppConfig.property [0] = new-Object VMware.Vim.VAppPropertySpec

    $spec.vAppConfig.property [0] .operation = 'Add '.

    $spec.vAppConfig.property [0] = new-Object VMware.Vim.VAppPropertyInfo .info

    $spec.vAppConfig.property [0].info.key = 0

    $spec.vAppConfig.property [0].info.classId = "Property1ClassID".

    $spec.vAppConfig.property [0].info.instanceId = "Property1InstanceID".

    $spec.vAppConfig.property [0].info.id = "Property_1.

    $spec.vAppConfig.property [0].info.category = "Property1Category".

    $spec.vAppConfig.property [0].info.label = "property 1.

    $spec.vAppConfig.property [0].info.type = "string".

    $spec.vAppConfig.property [0].info.userConfigurable = $true

    $spec.vAppConfig.property [0].info.defaultValue = "Property1DefaultValue".

    $spec.vAppConfig.property [0].info.value = «»

    $spec.vAppConfig.property [0].info.description = "Property1Description".

    $vm = get-VM-name vm3

    $vm. ExtensionData.ReconfigVM_Task ($spec)

  • Menu and toolbars, tabs suddenly LARGE, need to reset Firefox, not fixed by eliminating add-ins, only a reset works - help!

    Menu and toolbars, tabs suddenly LARGE, need to reset Firefox, not fixed by eliminating add-ins, only a reset works - help!

    Are you sure that this has not been caused by the Tab Mix Plus?

    Your list of details of the system shows a lot of disabled people with only active TMP extension.

    Have you checked for code in userChrome.css if you use this file to customize the user interface?

    In the Firefox Safe mode, these changes are effective:

    • all extensions are disabled (subject: addons)
    • Default theme is used (no persona)
    • userChrome.css and userContent.css are ignored (chrome in the profile folder file)
    • default toolbars is used
    • JIT JavaScript compilers are disabled
    • hardware acceleration is turned off (Options > Advanced Options > general)
    • plugins are not affected
    • preferences are not affected
  • Effectively remove and then add the piece of table 2D

    I have a table that is 72 lines (32 channels, 8 channels, 32 channels). I am now taking the middle 8 channels and move it to the end, he will be 32, 32, 8. I could delete a subset of the table, and then add at the end, but I think that it would cause 2 allowances. I wonder if there's a cleaner way to achieve inplace?

    Take 2 table subsets (32.8) (40,24) can do two replacements in the original array (index of 64 and 32).  I find that it is usually two times faster than delete + rebuild (to research cleaner), which is two times faster than the IPES (slower and uglier by far). Your mileage may vary.  It's all the microseconds at this size of table.

  • Installed Adobe Acrobat Standard XI on 2 computers using the 2 provided licenses. I need to take this on one computer, and add to another computer in the office. How can I do this?

    Installed Adobe Acrobat Standard XI on 2 computers using the 2 provided licenses. I need to take this on one computer, and add to another computer in the office. How can I do this?

    After getting your serial number, open the Acrobat none-more-necessary > help > deactivate.

    install and activate on your other computer.

Maybe you are looking for

  • ios10 integration of voip does not not with whatsapp

    Well, as seen on the video presentation of tge ios10, the integration of voip with whatsapp does not work on my iphone6s When I get a call via whatsapp I should have the style ring regularly call appear on my lock screen, in the same way that I had r

  • Serial RS232 Communication VISA write does not

    I am trying to send a SPELL of 5003 01 command to my card that I am logged in via Rs232. This command should get my PCB to change play modes. I posted about this problem before thinking it was a problem with it not sent in HEXADECIMAL: http://forums.

  • Cannot delete the System Volume Information trash

    I am running Windows xp on a Dell computer and I recently removed the System Volume Information folder on an external hard drive after the deactivation of the restoration of the system for this drive.  I don't remember how it happened, but the said f

  • How to install Vista SP1 after fail methods of "General Resolution" and "Advanced Troubleshooting" Microsoft online?

    I have Vista Home Premium 32-bit. I want to install SP1 (and, eventually, SP2 before the April deadline, deadline of 2010). I tried the "Windows Update" - it did not work. I downloaded the installation manual - it did not work. This is probably the r

  • Existing paid products on my laptop

    Hello I recently bought MS office 365 and Norton Security valid for one year for my laptop and I was wondering with the upgrade of Windows 10, will my purchase cancelled it is have will have to re - install them or that they will always be available