First, modify the table name to modify the index and the primary key
ALTER TABLE afa_auth_function RENAME to back_afa_auth_function ----Modify the form name alter tables Back_afa_auth_function RENAME Constraint pk_afa_auth_function to pk_back_afa_auth_function; ----Modify the PRIMARY key alter index pk_afa_auth_function rename to pk_back_afa_auth_function; ----Modifying indexes
In the integration of different systems, some tables are duplicated, and do not want to delete, this time you can modify the corresponding table name, primary key name, index name
Ii. usage of Case-when
Update Afa_auth_roleSetFsubsystemid= ( CaseWhen Fsubsystemid='C08AF79072F444878C7C5DEEA25187AA' Then'Nontax-platfrom'When Fsubsystemid='896a7961034b4559b4fc4a1520460075' Then'Nontax-base'When Fsubsystemid='8c36fdbdce80424a9ae3f11183e19f47' Then'nontax-agency'When Fsubsystemid='0816b0670e7d428d886e54e7fc0fcb5a' Then'nontax-finance'end);
Pay attention to the relevant wording.
Three, insert and time line number and so on with the use
Insert into afa_org (org_id, Org_code, Org_name, parent_org_id, Org_level, Is_leaf, Org_type, STATUS, Create_time, LAS Test_time)SelectT.fid asorg_id, T.ffindeptcode asOrg_code, T.ffindeptname asOrg_name, T.frgnid asparent_org_id,NULL asOrg_level,NULL asIs_leaf,'findept' asOrg_type, T.fisenable asSTATUS, To_date (T.fcreatetime,'YYYY-MM-DD Hh24:mi:ss') asCreate_time, To_date (To_char (To_timestamp (T.fupdatetime,'YYYYMMDDHH24MISSFF3'), 'YYYY-MM-DD Hh24:mi:ss'), 'YYYY-MM-DD Hh24:mi:ss') asLastest_time fromFab_fin_dept T;
Note the use of correlation functions.
Iv. Related Skills
Select ' _ ' as Party_code
by | | Two fields can be merged
Set where App_id<>'APPCENTER';
<> Not equal to flag
Oracle Usage Summary