Monday, January 22, 2018

Oracle important query

1. Query to Finding Columns and Tables :

     SELECT  table_name, column_name
     FROM   all_tab_columns
     WHERE column_name like 'PO_HEADER%’;

    select * from all_objects
   where object_name like '%PO_HEADERS_ALL%'
    and object_type = 'TABLE';

2. Query to Find Triggers on a Table:

     SELECT trigger_name
    FROM   all_triggers
    WHERE table_name = ‘<TABLE_NAME>”;

3. GL Batches Query:

   SELECT jb.NAME, gh.period_name,
   gh.je_source, gh.je_category,
   gh.currency_code, gc.concatenated_segments,
  gl.entered_cr,gl.entered_dr,
  gl.accounted_cr, gl.accounted_dr
  FROM gl_je_batches jb,
       gl_je_headers gh,
       gl_je_lines gl,
       gl_code_combinations_kfv gc
 WHERE jb.je_batch_id = gh.je_batch_id
   AND gh.je_header_id = gl.je_header_id
   AND gl.code_combination_id = gc.code_combination_id

4. Query to get Database Links:
      SELECT owner            "Owner",db_link          "Link Name",
      username         "Username",created          "Created",
     host             xonly_host
    FROM   all_db_links
  ORDER BY 1,2;


5. Query to get DBA Directories:
       SELECT owner            "Owner"
      ,directory_name   "Directory Name"
     , directory_path   "Directory Path"
    FROM   all_directories
    ORDER BY 1,2;

No comments:

Post a Comment