Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Oracle (https://www.clubdelphi.com/foros/forumdisplay.php?f=22)
-   -   Objetos de sistema y otros problemas (https://www.clubdelphi.com/foros/showthread.php?t=56337)

PaFernan99 14-05-2008 20:39:57

Objetos de sistema y otros problemas
 
Hola Gente!
La pregunta es la siguiente: ¿cómo puedo ver los objetos del sistema Oracle? Es decir, si quisiera ver las tablas que maneja el motor, haria la siguiente consulta:
Código SQL [-]
Select * from DBA_TABLES
y si quisiera ver los triggers sería
Código SQL [-]
Select * from DBA_TRIGGERS
por ejemplo, pero quisiera ver los demás componentes, como columnas, stored procedures, etc.
Otra cosa que necesito saber es como puedo ver si existe una cadena dentro de la definicion de un trigger, porque al hacer esta consulta
Código SQL [-]
Select * from DBA_TRIGGERS where TRIGGER_BODY LIKE '%cadena%'
genera el error ORA-00932: inconsistent datatype: expected NUMBER
got LONG.

Saludos y muchas gracias!

avmm2004 15-05-2008 23:16:29

Encontre este tema para buscar textos en un trigger_body de Oracle:

Es un script completo, igual te vale:
Código SQL [-]


SET SERVEROUTPUT ON
SET VERIFY OFF


ACCEPT search_string PROMPT "Enter the case-sensitive search string: "
PROMPT Please wait while the triggers are being searched ...

-- ----------------------------------------------------------
-- Name: search_triggers32.sql
-- Author: Dejan Jovanovic

-- Date: November 2002
-- Purpose: Search for the given text within a trigger body
-- Note: It can work only if the trigger body size is < 32K,
--       otherwise ORA-6502 is raised.
-- ----------------------------------------------------------
DECLARE
  CURSOR cur_triggers IS
    SELECT owner, trigger_name, trigger_body

    FROM all_triggers;
  v_position INTEGER;
BEGIN
  DBMS_OUTPUT.ENABLE(1000000);
  FOR rec_trigger IN cur_triggers LOOP
    v_position := INSTR(rec_trigger.trigger_body, '&search_string');
    IF v_position > 0 THEN
      --  Display the trigger details:
      DBMS_OUTPUT.PUT_LINE('========================================');

      DBMS_OUTPUT.PUT_LINE('Owner: ' || rec_trigger.owner || ', Trigger
Name: ' || rec_trigger.trigger_name);
      IF v_position >= 20 THEN
        -- Display a piece of code around the searched string:
        DBMS_OUTPUT.PUT_LINE(SUBSTR(rec_trigger.trigger_body, v_position - 20, 80) || CHR(10));
      ELSE
        -- Display a piece of code after the searched string:
        DBMS_OUTPUT.PUT_LINE(SUBSTR(rec_trigger.trigger_body, v_position, 80) || CHR(10));
      END IF;
    END IF;

  END LOOP;
END;

..... el enlace es :

http://www.oracle.com/technology/ora...03/020903.html


La franja horaria es GMT +2. Ahora son las 20:50:38.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi