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