Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. create or replace procedure pSleep (pSleepInMinutes NUMBER)
  2. as
  3. vNow DATE := SYSDATE;
  4. begin
  5. --
  6. procLog.info('INIT' || to_char(SYSDATE,'DD/MM/YYYY HH24:MI:SS'));
  7. --
  8. dbms_output.put_line('START: ' || to_char(vNow,'DD/MM/YYYY HH24:MI:SS'));
  9. --
  10. loop
  11. exit when vNow + (pSleepInMinutes * (1/1440)) <= SYSDATE;
  12. end loop;
  13. --
  14. procLog.info('END' || to_char(SYSDATE,'DD/MM/YYYY HH24:MI:SS'));
  15. --
  16. commit;
  17. --
  18. dbms_output.put_line('FINISH: ' || to_char(SYSDATE,'DD/MM/YYYY HH24:MI:SS'));
  19. end;
  20. /
  21.  
  22. Class.forName("oracle.jdbc.OracleDriver");
  23.  
  24. Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@100.100.00.000:1521:database11g", "pass", "pass");
  25. connection.setAutoCommit(true);
  26.  
  27. Statement stmt = connection.createStatement();
  28. try {
  29. stmt.execute("ALTER SESSION SET NLS_LANGUAGE = 'AMERICAN'");
  30. stmt.execute("ALTER SESSION SET NLS_TERRITORY = 'AMERICA'");
  31. } finally {
  32. stmt.close();
  33. }
  34. CallableStatement cs = connection.prepareCall("{call MYGRANT.pSleep(?)}");
  35. cs.setInt(1, 180);
  36. cs.execute();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement