Wednesday, October 31, 2018

Anchored Declaration in Oracle


Anchored Declaration is used to set the datatype of your variable based on the datatype of an already defined variable or a column of a table.

PL/SQL offers two kinds of anchoring:

Scalar anchoring :- Use the %TYPE attribute to define your variable based on a table's column or an already declared PL/SQL scalar variable.

Record anchoring :- Use the %ROWTYPE attribute to define your record structure based on a table or a predefined PL/SQL explicit cursor.

Thursday, October 25, 2018

Query for get Concurrent Program Trace file Path Location in Oracle Apps


SELECT req.request_id,
       req.logfile_node_name node,
       req.oracle_Process_id,
       req.enable_trace,
          dest.VALUE
       || '/'
       || LOWER (dbnm.VALUE)
       || '_ora_'
       || oracle_process_id
       || '.trc'
          trace_filename,
       prog.user_concurrent_program_name,
       execname.execution_file_name,
       execname.subroutine_name,
       phase_code,
       status_code,
       ses.SID,
       ses.serial#,
       ses.module,
       ses.machine
  FROM fnd_concurrent_requests req,
       v$session ses,
       v$process proc,
       v$parameter dest,
       v$parameter dbnm,
       fnd_concurrent_programs_vl prog,
       fnd_executables execname
 WHERE     1 = 1
       AND req.request_id = &request      --Concurrent Request ID
       AND req.oracle_process_id = proc.spid(+)
       AND proc.addr = ses.paddr(+)
       AND dest.NAME = 'user_dump_dest'
       AND dbnm.NAME = 'db_name'
       AND req.concurrent_program_id = prog.concurrent_program_id
       AND req.program_application_id = prog.application_id
       AND prog.application_id = execname.application_id
       AND prog.executable_id = execname.executable_id

Wednesday, October 10, 2018

Access Control in Oracle EBS and Oracle Fusion

Access Control
Oracle EBS
Oracle Fusion
Responsibility
Data Role
Top Level Menu
Job Role
Abstract Role
Sub Menu
Duty Role
Form Function
Privilege
Executable
Permission

Organization Structure in Oracle EBS and Oracle Fusion

Oracle EBS R12:-



Oracle Fusion 11g:-

API Script to fetch Table Structure from Backend in Oracle


Please Note that this script will fetch only Table Structure but not Primary Key, Foreign Keys, Unique Keys, Indexes..etc.

DECLARE
   x_table_header      VARCHAR2 (50);
   x_data_type_row   VARCHAR2 (100);
   x_data_type           VARCHAR2 (100);
   tab_count               NUMBER := 0;
   x_column_id          NUMBER := 0;

   CURSOR tab
   IS
      SELECT ao.object_name
        FROM all_objects ao
       WHERE ao.object_type = 'TABLE'
         AND ao.object_name = 'XX_TEST1';

   CURSOR cols (p_table_name VARCHAR2)
   IS
        SELECT *
          FROM all_tab_columns atc
         WHERE atc.table_name = p_table_name
      ORDER BY column_id;
BEGIN
   DBMS_OUTPUT.enable (10000000);

   FOR i IN tab
   LOOP
      tab_count := tab_count + 1;
      x_table_header := 'CREATE TABLE ' || i.object_name || ' (';

      DBMS_OUTPUT.PUT_LINE (x_table_header);

      FOR j IN cols (i.object_name)
      LOOP
         SELECT MAX (atc.column_id)
           INTO x_column_id
           FROM all_tab_columns atc
          WHERE atc.table_name = i.object_name;

         IF j.column_id <> x_column_id
         THEN
            SELECT    j.data_type
                   || DECODE (j.data_type,
                              'VARCHAR2', '(' || j.data_length || '),',
                              ',')
              INTO x_data_type
              FROM dual;

            x_data_type_row :=
               RPAD (j.column_name, 30, ' ') || '      ' || x_data_type;
         ELSIF j.column_id = x_column_id
         THEN
            SELECT    j.data_type
                   || DECODE (j.data_type,
                              'VARCHAR2', '(' || j.data_length || '));',
                              ');')
              INTO x_data_type
              FROM dual;

            x_data_type_row :=
               RPAD (j.column_name, 30, ' ') || '      ' || x_data_type;
         END IF;

         DBMS_OUTPUT.PUT_LINE (x_data_type_row);
      END LOOP;

      DBMS_OUTPUT.PUT_LINE (' ');
   END LOOP;
END;

Monday, October 8, 2018

How to copy Directories with cp Command in Linux

We can copy directories with the Linux cp command, we need to use -r option. For example, this command copies the directory named xxdir to the /home/xxuser directory:

cp -r xxdir /tmp/xxuser

If you try to copy a directory without using the -r argument we will get xxdir is a directory(not copied) error message as shown in below screenshot.


Monday, October 1, 2018

What's the difference between Primary Quantity and Secondary Quantity?


  • Primary Quantity is the quantity of items in the primary unit of measure.
  • Secondary Quantity is the quantity of items in the secondary unit of measure.

Query To Fetch AP Invoice Details From SO Number(Doc ID 2949013.1)

SELECT dh.source_order_number       ,df.source_line_number as so_line_number   ,df.fulfill_line_number    ,ddr.doc_user_key as po_number...