| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> oracle >> Oracle shu ju ku zhong huo qu shu ju de cun chu guo cheng shi li
 

Oracle shu ju ku zhong huo qu shu ju de cun chu guo cheng shi li

2008-08-06 07:16:30 编辑來源:互联网 评论
 
本文为【Oracle数据库中获取数据的存储过程示例】的拼音翻译版
  >> cong yi ge biao A de qu de shu ju cha ru ling yi ge biao B zhong ?
  (1) dui yu biao A he biao B liang ge biao jie gou wan quan xiang tong de hua 〔 zi duan ge shu , xiang ying zi duan de lei xing deng deng 〕, ke yi shi yong
  INSERT INTO B SELECT * FROM A;
  INSERT INTO B(field1,field2,field3) select A.field1,A.field2,A.field3 from A;
  (2) dui yu liang ge biao ru guo zi duan shu bu yi yang , dan shi you ji ge zi duan de jie gou yi yang shi 〔 lei si yu fu zi guan xi 〕, bi xu shi yong INSERT INTO B(field1,field2) select A.field1,A.field2 from A;
  1. yong dai shen shu de you biao shi xian insert gong neng :
  CREATE OR REPLACE PROCEDURE GET_DATA(
  -- shen shu lie biao :
  n_task_id IN number, -- ren wu bian hao
  v_task_name IN varchar2, -- ren wu ming cheng
  v_name IN varchar2 -- ming cheng
  )
  -----------------------------------------------
  -- PROCEDURE ming :GET_DATA --
  -- chu li nei rong : cong shu ju yuan biao qu de fu he tiao jian de de shu ju cha ru dao mu biao shu ju biao : --
  -- yin shu :n_tas_id ren wu ID, --
  -- v_task_namek ren wu ming cheng , --
  -- v_bdw_name dui shu ju yuan biao xian zhi tiao jian : ben di wang ming cheng --
  -----------------------------------------------
  IS
  -- cha ru xing shu kong zhi
  i_count number(5);
  -- qu shu ju you biao :DATA_CUR(IN_NAME)
  -- shen shu : ben di wang ming cheng :IN_NAME
  CURSOR DATA_CUR(IN_NAME VARCHAR2) IS /** zhu yi : shen shu de ding yi zhong bu dai jing du **/
  SELECT *
  FROM GET_DATA_SRC A
  WHERE A.NAME = IN_NAME;
  BEGIN
  -- ji shu qi , kong zhi cha ru xing shu
  i_count := 0;
  -- xun huan cha ru shu ju
  FOR MYCUR IN DATA_CUR(v_name) LOOP
  INSERT INTO ABC(
  ROW_ID,
  TASK_ID,
  TASK_NAME,
  GET_DATA_DT,
  CUST_ID,
  ASSIGN_FLAG,
  DEAL_DATE
  )VALUES(
  SEQ_KD.NEXTVAL,
  N_TASK_ID,
  V_TASK_NAME,
  SYSDATE,
  MYCUR.CUST_ID,
  'N',
  NULL
  );
  -- cheng xu shi yong jie duan , yi hou hui shan chu satrt
  i_count := i_count + 1;
  IF i_count >100 THEN
  COMMIT;
  RETURN;
  END IF;
  -- cheng xu shi yong jie duan , yi hou hui shan chu end
  END LOOP;
  -- shu ju commit, cheng xu tiao shi jie duan bi mian da liang shu ju , zan shi guan bi
  --commit;
  -------- li wai chu li bu fen ----------------------------
  EXCEPTION
  WHEN OTHERS THEN
  rollback;
  END SRBZ_GET_SRBZ_KD_SPEED;
  /
  2. shi yong yu ju pin jie fa shi xian insert gong neng :
  zhu :2.1 zi fu chuan chang liang de yin hao 2.2 bian liang de yin hao
  CREATE OR REPLACE PROCEDURE ABC(
  -- shen shu lie biao :
  task_id IN number, -- ren wu bian hao
  task_name IN varchar2, -- ren wu ming cheng
  in_NAME IN varchar2 -- ming cheng
  )
  --------------------------- PROCEDURE ming :ABC
  -- chu li nei rong : cong shu ju yuan biao qu de fu he tiao jian de de shu ju cha ru dao mu biao shu ju biao
  -- yin shu :table_src shu ju yuan biao
  -- table_to shu ju cha ru mu biao biao
  -- in_bdw_name dui shu ju yuan biao xian zhi tiao jian : ben di wang ming cheng
  ---------------------------------------------
  IS
  --INSERT_STRING dong tai sheng cheng de insert yu ju cun fang chu
  INSERT_STRING VARCHAR2(1000);
  -- shu ju yuan biao cun fang chu
  tableSrc varchar2(500);
  -- shu ju cha ru mu biao biao cun fang chu
  tableTarget varchar2(1000);
  -- shu ju mu biao biao xu yao cha ru zhi de zi duan cun fang chu
  StrFields varchar2(1000);
  BEGIN
  -- shu ju yuan biao wei :AAA
  tableTarget := ' BBB ';
  -- shu ju lai yuan
  tableSrc := ' select seq_kd.nextval,sysdate,'||task_id||','''||task_name||''', '
  ||'A.* from AAA A'
  ||' WHERE A.value='||'''IP-VPDN'''
  ||'AND A.remark IS NULL';
  -- xu yao cha ru de zi duan
  StrFields := '(ROW_ID,GET_DATA_DT,TASK_ID,TASK_NAME,COST_CTR,SERVICE_ID,'
  ||'SI_ADDR,SI_SERVER_ID)';
  -- sheng cheng insert yu ju
  INSERT_STRING := 'INSERT INTO ' || tableTarget || StrFields || tableSrc ;
  -- zhi xing insert yu ju
  execute immediate INSERT_STRING;
  -- ti jiao shi wu
  commit;
  -------- li wai chu li bu fen -------------------------------------------------------
  EXCEPTION
  -- yi chang de pao chu
  WHEN OTHERS THEN
  --DBMS_OUTPUT.PUT_LINE(' chu li guo cheng zhong chu cuo , cheng xu tui chu , wei zhi xing xiang guan nei wu ');
  rollback;
  END SRBZ_GET_SRBZ_KD_GSVPDN_FREE;
  /【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
>> cong yi ge biao A de qu de shu ju cha ru ling yi ge biao B zhong ? (1) dui yu biao A he biao B liang ge biao jie gou wan quan xiang tong de hua 〔 zi duan ge shu , xiang ying zi duan de lei xing deng deng 〕, ke yi shi yong INSERT INTO B SELECT * FROM A; INSERT INTO B(field1,field2,field3) select A.field1,A.field2,A.field3 from A; (2) dui yu liang ge biao ru guo zi duan shu bu yi yang , dan shi you ji ge zi duan de jie gou yi yang shi 〔 lei si yu fu zi guan xi 〕, bi xu shi yong INSERT INTO B(field1,field2) select A.field1,A.field2 from A; 1. yong dai shen shu de you biao shi xian insert gong neng : CREATE OR REPLACE PROCEDURE GET_DATA( -- shen shu lie biao : n_task_id IN number, -- ren wu bian hao v_task_name IN varchar2, -- ren wu ming cheng v_name IN varchar2 -- ming cheng ) ----------------------------------------------- -- PROCEDURE ming :GET_DATA -- -- chu li nei rong : cong shu ju yuan biao qu de fu he tiao jian de de shu ju cha ru dao mu biao shu ju biao : -- -- yin shu :n_tas_id ren wu ID, -- -- v_task_namek ren wu ming cheng , -- -- v_bdw_name dui shu ju yuan biao xian zhi tiao jian : ben di wang ming cheng -- ----------------------------------------------- IS -- cha ru xing shu kong zhi i_count number(5); -- qu shu ju you biao :DATA_CUR(IN_NAME) -- shen shu : ben di wang ming cheng :IN_NAME CURSOR DATA_CUR(IN_NAME VARCHAR2) IS /** zhu yi : shen shu de ding yi zhong bu dai jing du **/ SELECT * FROM GET_DATA_SRC A WHERE A.NAME = IN_NAME; BEGIN -- ji shu qi , kong zhi cha ru xing shu i_count := 0; -- xun huan cha ru shu ju FOR MYCUR IN DATA_CUR(v_name) LOOP INSERT INTO ABC( ROW_ID, TASK_ID, TASK_NAME, GET_DATA_DT, CUST_ID, ASSIGN_FLAG, DEAL_DATE )VALUES( SEQ_KD.NEXTVAL, N_TASK_ID, V_TASK_NAME, SYSDATE, MYCUR.CUST_ID, 'N', NULL ); -- cheng xu shi yong jie duan , yi hou hui shan chu satrt i_count := i_count + 1; IF i_count >100 THEN COMMIT; RETURN; END IF; -- cheng xu shi yong jie duan , yi hou hui shan chu end END LOOP; -- shu ju commit, cheng xu tiao shi jie duan bi mian da liang shu ju , zan shi guan bi --commit; -------- li wai chu li bu fen ---------------------------- EXCEPTION WHEN OTHERS THEN rollback; END SRBZ_GET_SRBZ_KD_SPEED; / 2. shi yong yu ju pin jie fa shi xian insert gong neng : zhu :2.1 zi fu chuan chang liang de yin hao 2.2 bian liang de yin hao CREATE OR REPLACE PROCEDURE ABC( -- shen shu lie biao : task_id IN number, -- ren wu bian hao task_name IN varchar2, -- ren wu ming cheng in_NAME IN varchar2 -- ming cheng ) --------------------------- PROCEDURE ming :ABC -- chu li nei rong : cong shu ju yuan biao qu de fu he tiao jian de de shu ju cha ru dao mu biao shu ju biao -- yin shu :table_src shu ju yuan biao -- table_to shu ju cha ru mu biao biao -- in_bdw_name dui shu ju yuan biao xian zhi tiao jian : ben di wang ming cheng --------------------------------------------- IS --INSERT_STRING dong tai sheng cheng de insert yu ju cun fang chu INSERT_STRING VARCHAR2(1000); -- shu ju yuan biao cun fang chu tableSrc varchar2(500); -- shu ju cha ru mu biao biao cun fang chu tableTarget varchar2(1000); -- shu ju mu biao biao xu yao cha ru zhi de zi duan cun fang chu StrFields varchar2(1000); BEGIN -- shu ju yuan biao wei :AAA tableTarget := ' BBB '; -- shu ju lai yuan tableSrc := ' select seq_kd.nextval,sysdate,'||task_id||','''||task_name||''', ' ||'A.* from AAA A' ||' WHERE A.value='||'''IP-VPDN''' ||'AND A.remark IS NULL'; -- xu yao cha ru de zi duan StrFields := '(ROW_ID,GET_DATA_DT,TASK_ID,TASK_NAME,COST_CTR,SERVICE_ID,' ||'SI_ADDR,SI_SERVER_ID)'; -- sheng cheng insert yu ju INSERT_STRING := 'INSERT INTO ' || tableTarget || StrFields || tableSrc ; -- zhi xing insert yu ju execute immediate INSERT_STRING; -- ti jiao shi wu commit; -------- li wai chu li bu fen ------------------------------------------------------- EXCEPTION -- yi chang de pao chu WHEN OTHERS THEN --DBMS_OUTPUT.PUT_LINE(' chu li guo cheng zhong chu cuo , cheng xu tui chu , wei zhi xing xiang guan nei wu '); rollback; END SRBZ_GET_SRBZ_KD_GSVPDN_FREE; /
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
我们约会吧
漂亮白皙的模特
好纯好美的女生
靓丽的网络美女
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有