Thursday, April 23, 2015

See Trigger Code

Query to see Trigger Code

SELECT text FROM dba_source 
WHERE owner = 'owner name' AND name = 'trigger name' 
ORDER BY line

 Other Important tables
  • All_triggers
  • All_Views
  • All_Tables

Thursday, April 16, 2015

Select a substring in Oracle SQL up to a specific character

Using a combination of SUBSTR and INSTR you can get a substring in Oracle SQL up to a specific character

SELECT SUBSTR('ABC_blahblahblah', 0, INSTR('ABC_blahblahblah', '_')-1) AS output
  FROM DUAL

Result:
output
------
ABC

General Syntax
:

SELECT SUBSTR(t.column, 0, INSTR(t.column, '_')-1) AS output
  FROM YOUR_TABLE t