Bo's Oracle Station

查看: 1705|回复: 0

第77次:2014-12-26

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-12-28 10:41:40 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2014-12-30 12:45 编辑
  1. select  * from dba_tables t where t.owner='HR';

  2. select * from hr.SCHEDULER_TEST;

  3. select  * from dbA_sequences s where s.sequence_owner='HR';

  4. drop table hr.SCHEDULER_TEST;

  5. drop sequence  hr.SCHEDULER_TEST_SEQ;

  6. create table hr.SCHEDULER_TEST ( test_id  number  , program_name  varchar2(30)  ,  test_time date ) ;

  7. create sequence  hr.SCHEDULER_TEST_SEQ  order;

  8. select * from hr.SCHEDULER_TEST   order by  test_time;

  9. truncate table hr.scheduler_test;



  10. DECLARE

  11.   l_enqueue_options     DBMS_AQ.enqueue_options_t;

  12.   l_message_properties  DBMS_AQ.message_properties_t;

  13.   l_message_handle      RAW(16);

  14.   l_queue_msg           t_event_queue_payload;

  15. BEGIN

  16.   l_queue_msg := t_event_queue_payload('give_me_a_prod');



  17.   DBMS_AQ.enqueue(queue_name          => 'event_queue',

  18.                   enqueue_options     => l_enqueue_options,

  19.                   message_properties  => l_message_properties,

  20.                   payload             => l_queue_msg,

  21.                   msgid               => l_message_handle);

  22.   COMMIT;

  23. END;

  24. ------


  25. BEGIN
  26. sys.dbms_scheduler.disable('"HR"."CHAIN1"');
  27. sys.dbms_scheduler.define_chain_rule(
  28. chain_name => '"HR"."CHAIN1"',
  29. condition => 'step1 completed',
  30. rule_name => 'RULE2',
  31. comments => 'rule2',
  32. action => 'START "STEP3"');
  33. sys.dbms_scheduler.define_chain_rule(
  34. chain_name => '"HR"."CHAIN1"',
  35. condition => 'step1 failed',
  36. rule_name => 'RULE3',
  37. comments => 'rule3',
  38. action => 'START "STEP2"');
  39. sys.dbms_scheduler.define_chain_rule(
  40. chain_name => '"HR"."CHAIN1"',
  41. condition => 'step2 completed',
  42. rule_name => 'RULE5',
  43. comments => 'rule5',
  44. action => 'END');
  45. sys.dbms_scheduler.enable('"HR"."CHAIN1"');
  46. END;
  47. <div class="blockcode"><blockquote>create or replace procedure hr.proc_test( p_1 in number , p_2  out   number)
  48. is
  49. begin
  50.   update employees set salary=10000 where employee_id=p_1;
  51.   select  salary into p_2 from  employees  where employee_id=p_1;
  52. end;


  53. declare
  54.   v_2  number;
  55. begin
  56.    proc_test(100,v_2);
  57.    dbms_output.put_line('The salary of employee 100 is '||v_2||'.');
  58. end;

  59. create or replace procedure  proc_test_io( p_1  in out number )  
  60. is
  61. begin
  62.   p_1 := p_1*2;
  63.   
  64. end;

  65. declare
  66.   v_1  number;
  67.   
  68. begin
  69.    v_1 :=2;
  70.    proc_test_io(v_1);
  71.     dbms_output.put_line(v_1);
  72. end;

  73. select  * from scheduler_test;

  74. drop table scheduler_test;

  75. create table  scheduler_test (id number , created_date  date );

  76. alter table scheduler_test add (  event_name  varchar2(30) );

  77. drop sequence scheduler_test_seq;
  78. create sequence  scheduler_test_seq  order ;


  79. create or replace procedure  procnew( p_1     sys.t_event_queue_payload    )
  80. is

  81. BEGIN
  82.      INSERT INTO scheduler_test
  83.          VALUES (scheduler_test_seq.NEXTVAL, SYSDATE,     p_1.event_name   );
  84.          COMMIT;
  85. END;


  86. select * from dba_scheduler_program_args  pa where pa.owner='HR';

  87. begin
  88.    dbms_scheduler.define_metadata_argument (
  89.     program_name => 'hr.programnew',
  90.     argument_position => 1 ,
  91.    metadata_attribute => 'EVENT_MESSAGE') ;
  92.    
  93. end;





复制代码


---

begin
raise_application_error('-20001','Something wrong');
end;
----



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-22 05:05 , Processed in 0.036525 second(s), 24 queries .

快速回复 返回顶部 返回列表