oracle record table 乙個例項

2021-07-02 03:48:20 字數 2494 閱讀 7749

感覺不錯的例項,記錄一下

set serveroutput on;

declare

type company is record(

companyid varchar2(10),

companyname varchar2(300),

address varchar2(300),

legalrepresentative varchar2(100)

);type companys is table of company index by binary_integer;

v_companys companys;

v_companyid varchar2(10);

v_companyname varchar2(300);

v_address varchar2(300);

v_legalrepresentative varchar2(100);

v_rownumber number(2);

v_count number(2);

begin

v_rownumber := 1;

v_companys(v_rownumber).companyid := '7084';

v_companys(v_rownumber).companyname := '深圳市****1';

v_companys(v_rownumber).address := '深圳市福田場(二期)西座1602';

v_companys(v_rownumber).legalrepresentative := '張三';

v_rownumber := v_rownumber + 1;

v_companys(v_rownumber).companyid := '7827;

v_companys(v_rownumber).companyname := '深圳市****2';

v_companys(v_rownumber).address := '深圳市蛇口南海小筑c7';

v_companys(v_rownumber).legalrepresentative := '李四';

v_rownumber := v_rownumber + 1;

v_companys(v_rownumber).companyid := '7586';

v_companys(v_rownumber).companyname := '深圳光匯石油「

v_companys(v_rownumber).legalrepresentative := '張在';

--dbms_output.put_line(v_rownumber);

update bas_managecompany set adminorgcode=null where adminorgcode='140000';

update bas_managecompany set auditorgcode=null where auditorgcode='140000';

for i in 1 .. v_companys.count loop

v_companyid := v_companys(i).companyid;

v_companyname := v_companys(i).companyname;

v_address := v_companys(i).address;

v_legalrepresentative := v_companys(i).legalrepresentative;

select count(1) into v_count from bas_company where companyid=v_companyid;

if(v_count =0) then

insert into bas_company(companyid,organizationcode,legalrepresentative,companyname,nationalitycode,provincecode,citycode,address,naturecode)

values(v_companyid,v_companyid,v_legalrepresentative,v_companyname,'125','440000','440300',v_address,'01');

insert into bas_managecompany(companyid,adminorgcode,ifsystem)

values(v_companyid,'190000',0);

else

update bas_managecompany set adminorgcode='190000' where companyid=v_companyid;

update bas_managecompany set auditorgcode='190000' where companyid=v_companyid and ifsystem=1;

end if;

end loop;

commit;

end;

/

android 只起乙個Activity例項

在乙個activity中,多次呼叫startactivity 來啟動另乙個activity,要想只生成乙個activity例項,方法有兩種。b 方法一 設定起動模式 b 乙個activity有四種啟動模式 standard,singletop,singletask,singleinstance。st...

android 只起乙個Activity例項

在乙個activity中,多次呼叫startactivity 來啟動另乙個activity,要想只生成乙個activity例項,方法有兩種。b 方法一 設定起動模式 b 乙個activity有四種啟動模式 standard,singletop,singletask,singleinstance。st...

手工編寫乙個XML Schema XSD 的例項

簡單說 xml schema就是xml的乙個class,也相當於關係表的表結構模式。目前大都可以由程式根據已有的xml自動生成它的xsd,或者根據關係表生成它相應的xsd 實際就是將關係資料轉換成xml資料,vs2005中的型別化的dataset就是這樣實現的 對xml schema做一些簡單了解還...