Oracle
 sql >> Database >  >> RDS >> Oracle

Eseguire la stored procedure di SQL Server tramite collegamento al database da Oracle

In realtà è possibile chiamare stored procedure o funzioni tramite dg4odbc. Ho testato Database Gateway per MS SQL Server , e comunque non è riuscito a supportare nativamente le funzioni a valori scalari/tabella di Sql Server. Entrambi devono fare affidamento su DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE per questa funzionalità. Dovevamo recuperare l'ID delle righe inserite:

DECLARE
  RESULT NUMBER(8,2);
  val  INTEGER;
  c    INTEGER;
  nr   INTEGER;
BEGIN

  RESULT := example@sqldat.com('select SCOPE_IDENTITY();');
  c := example@sqldat.com; 
  example@sqldat.com(c, 'select @@IDENTITY');
  LOOP
    nr := example@sqldat.com(c);
    EXIT WHEN nr = 0;
    example@sqldat.com(c, 1, val);
  END LOOP;  
  example@sqldat.com(c); 
  DBMS_OUTPUT.PUT_LINE('retrieved: ' || val);
END;