Oracle modifies field lengths and calculates the number of days

Source: Internet
Author: User

syntax for SQL to modify field lengths:

ALTER TABLE name modify field type;

Example code for SQL to modify field lengths

ALTER TABLE Qtline modify Qtl_bidernote VARCHAR2 (4000);

Standard SQL, applicable to any database

ALTER TABLE fzrtmis.reporttemplate modify RepName varchar (100);

Modify Field name Name

ALTER TABLE TABLENAME RENAME COLUMN COL1 to COL2;

Add Field

ALTER TABLE FZRTMIS.ITIEMBUILDQK add Stationstate CHAR (1)

Category: Database Oracle

  

Calculate the number of days before two hours:

Select To_date (' 20110701 ', ' Yyyy-mm-dd ')-to_date (' 20050101 ', ' yyyy-mm-dd ') from Dual;select to_date (' 20150730 ', ' Yyyy-mm-dd ')-to_date (' 20110701 ', ' YYYY-MM-DD ') from dual;

Calculate interest:

create OR REPLACE PROCEDURE wyl_jsznj (pi_date_ksin VARCHAR2,--start date                                      Pi_date_zj in VARCHAR2,--intermediate time Pi_date_js in VARCHAR2,--End time                                       Pi_benjin in number, po_fhz out VARCHAR2, Po_zje out number) Isv_cz1number (5);--Difference 1 V_CZ2 number (5);--Difference 2v_jine2number (10);  --Amount V_jine2 number (ten); V_zje number (10);--Total amount begin v_jine: = 0;  Select (To_date (PI_DATE_ZJ, ' Yyyy-mm-dd ')-to_date (pi_date_ks, ' yyyy-mm-dd ')) into the v_cz1 from dual;  Select (To_date (pi_date_js, ' Yyyy-mm-dd ')-to_date (pi_date_zj, ' yyyy-mm-dd ')) into the v_cz2 from dual; For I in 1..  V_CZ1 LOOP Pi_benjin: = pi_benjin* (1+0.003);  END LOOP;  V_jine: = Pi_benjin; for j in 1..  V_CZ2 LOOP V_jine: = v_jine* (1+0.0005);  END LOOP; Po_zje: = V_jine; END; 

  

Oracle modifies field lengths and calculates the number of days

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.