Saturday, July 23, 2022

PL/SQL Tutorial: Anonymous Blocks, Procedures, Functions, and Packages with Simple Examples

PL/SQL Tutorial: Anonymous Blocks, Procedures, Functions, and Packages

📝 PL/SQL Tutorial: Anonymous Blocks, Procedures, Functions, and Packages with Simple Examples

PL/SQL is a powerful block-structured language used in Oracle databases for procedural programming. It allows developers to write modular, reusable code.


📚 1. PL/SQL Block Structure Overview

PL/SQL code can be categorized as:

  • Anonymous Blocks: Unnamed, not stored in the database, used for quick scripts
  • Named Blocks: Stored in the database, reusable
    • Functions
    • Procedures
    • Packages

Example to get current year:

SELECT TO_CHAR(SYSDATE, 'YYYY') FROM DUAL;
Anonymous blocks are quick, one-time use code blocks. Named blocks like functions, procedures, and packages are stored in the database and can be reused multiple times, making your code cleaner and more maintainable.

🔹 2. Functions

What is a Function?

A function returns a value and can be used in SQL statements or PL/SQL code.

  • Oracle Provided Functions: TO_CHAR(), TO_DATE(), SUM(), AVG(), etc.
  • User Defined Functions: Custom functions for specific logic.
Functions take input parameters, perform calculations or operations, and return a single value. You can use built-in Oracle functions or create your own to encapsulate logic you want to reuse.

Syntax to Create a Function

CREATE [OR REPLACE] FUNCTION function_name [(parameters)] RETURN return_datatype IS | AS
  [declaration_section]
BEGIN
  executable_section
  [EXCEPTION exception_section]
END [function_name];

Example: Calculate Area of Circle

CREATE OR REPLACE FUNCTION AREA_CIRC_FUNC (V_RADIUS INTEGER) RETURN INTEGER IS
  V_AREA NUMBER;
BEGIN
  V_AREA := 3.14 * (V_RADIUS * V_RADIUS);
  RETURN V_AREA;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('SOME ERROR: ' || SQLERRM);
    RETURN NULL;
END;

How to Run the Function?

1. From PL/SQL Block:

DECLARE
  V_AREA NUMBER;
  V_RADIUS INTEGER := &a;
BEGIN
  V_AREA := AREA_CIRC_FUNC(V_RADIUS);
  DBMS_OUTPUT.PUT_LINE('AREA OF CIRCLE IS: ' || V_AREA);
END;

2. From SQL Query:

SELECT AREA_CIRC_FUNC(100) FROM DUAL;
You can call functions directly within PL/SQL blocks or SQL queries. Functions simplify code by encapsulating reusable logic like calculating the area of a circle.

🔹 3. Procedures

What is a Procedure?

A procedure is a named PL/SQL block that performs an action but does not return a value directly.

Procedures are used when you want to perform tasks such as inserting data, printing messages, or any operation that does not need to return a value.

Basic Procedure Example

CREATE OR REPLACE PROCEDURE PRINT_MSG_PRC IS
BEGIN
  DBMS_OUTPUT.PUT_LINE('HELLO WORLD');
END PRINT_MSG_PRC;

Execute Procedure

EXEC PRINT_MSG_PRC;

or

BEGIN
  PRINT_MSG_PRC;
END;

Procedure with Parameters

IN Parameter (default mode)

CREATE OR REPLACE PROCEDURE ADD_VAL_PRC(X IN NUMBER) IS
  V NUMBER(5);
BEGIN
  V := X + 5000;
  DBMS_OUTPUT.PUT_LINE(V);
END;

Run:

EXEC ADD_VAL_PRC(1000);

Procedure with Multiple IN Parameters

CREATE OR REPLACE PROCEDURE PRINT_EMP_PRC(
  v_empno NUMBER,
  v_sal   NUMBER
) IS
  vname VARCHAR2(10);
BEGIN
  SELECT ename INTO vname FROM empl WHERE empno = v_empno AND sal = v_sal;
  DBMS_OUTPUT.PUT_LINE('Employee name: ' || vname);
END;

Run:

EXEC PRINT_EMP_PRC(7839, 5000);
Procedures can accept parameters to make them flexible. IN parameters allow passing values to the procedure. You can create procedures to perform various tasks using the input parameters.

OUT Parameter Example

CREATE OR REPLACE PROCEDURE PRINT_ENAME_PRC(
  vin_empno IN NUMBER,
  vout_ename OUT VARCHAR2
) IS
BEGIN
  SELECT ename INTO vout_ename FROM empl WHERE empno = vin_empno;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('SOME ERROR: ' || SQLERRM);
END;

Call with anonymous block:

DECLARE
  V_EMPNO NUMBER := &A;
  V_ENAME VARCHAR2(100);
BEGIN
  PRINT_ENAME_PRC(V_EMPNO, V_ENAME);
  DBMS_OUTPUT.PUT_LINE('Value from procedure: ' || V_ENAME);
END;
OUT parameters allow a procedure to send data back to the caller. This is useful when you want to retrieve values like employee names or calculations.

IN OUT Parameter Example

CREATE OR REPLACE PROCEDURE DER_SAL_PRC(x IN OUT NUMBER) IS
BEGIN
  SELECT sal INTO x FROM empl WHERE empno = x;
END DER_SAL_PRC;

Call:

DECLARE
  V_EMPNO NUMBER := &A;
BEGIN
  DER_SAL_PRC(V_EMPNO);
  DBMS_OUTPUT.PUT_LINE('Salary of employee is: ' || V_EMPNO);
END;
IN OUT parameters act as both input and output. You pass a value in, and the procedure modifies or returns a related value.

🔹 4. Packages

What is a Package?

A package groups related procedures, functions, variables, and other elements together.

Packages help organize your code logically and improve maintainability by grouping related subprograms together. They have two parts: specification (interface) and body (implementation).

Package Specification Syntax

CREATE [OR REPLACE] PACKAGE package_name IS
  -- Public declarations
  [PROCEDURE procedure_name (parameters);]
  [FUNCTION function_name (parameters) RETURN datatype;]
END package_name;
/

Package Body Syntax

CREATE [OR REPLACE] PACKAGE BODY package_name IS
  -- Implementation of procedures and functions
END package_name;
/

Example: Math Package

Package Spec

CREATE OR REPLACE PACKAGE MATH_PKG IS
  FUNCTION AREA_CIRC_FUN (VIN NUMBER) RETURN NUMBER;
  PROCEDURE AREA_SQR_PRC (VIN NUMBER);
END MATH_PKG;
/

Package Body

CREATE OR REPLACE PACKAGE BODY MATH_PKG IS

  FUNCTION AREA_CIRC_FUN (VIN NUMBER) RETURN NUMBER IS
    V_AREA NUMBER;
  BEGIN
    V_AREA := 3.14 * (VIN * VIN);
    RETURN V_AREA;
  EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('ERROR in AREA_CIRC_FUN: ' || SQLERRM);
      RETURN 0;
  END;

  PROCEDURE AREA_SQR_PRC (VIN NUMBER) IS
    V_AREA NUMBER;
  BEGIN
    V_AREA := VIN * VIN;
    DBMS_OUTPUT.PUT_LINE('AREA OF SQUARE IS: ' || V_AREA);
  EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('ERROR in AREA_SQR_PRC: ' || SQLERRM);
  END;

END MATH_PKG;
/

Using the Package

DECLARE
  V_IN_RAD NUMBER := &A;
  V_IN_SIDE NUMBER := &B;
  V_AREA_CIRCLE NUMBER;
BEGIN
  -- Call package function
  V_AREA_CIRCLE := MATH_PKG.AREA_CIRC_FUN(V_IN_RAD);
  DBMS_OUTPUT.PUT_LINE('AREA OF CIRCLE IS: ' || V_AREA_CIRCLE);

  -- Call package procedure
  MATH_PKG.AREA_SQR_PRC(V_IN_SIDE);
END;
/

Summary

Concept Description Example Use Case
Anonymous Block Temporary unnamed PL/SQL block Quick scripts or tests
Function Named block returning a value Calculating areas, business logic
Procedure Named block performing actions, no return Print messages, complex logic
Package Group of related functions and procedures Organizing code by functionality

Happy Coding! 🚀

SQL And PLSQL OVERVIEW

Here is the **HTML version** of your formatted “SQL & PL/SQL Overview” document. It includes structured sections, syntax-highlighted code blocks, and well-organized content. --- ### ✅ \[Downloadable HTML File Option] If you'd like, I can also give you a `.html` file to upload directly to your Blogspot or view offline. Just let me know. --- ### 📄 Full HTML Code: ```html SQL & PL/SQL Overview

SQL & PL/SQL Overview

🔖 Audience

This tutorial is for software professionals who want to learn PL/SQL in a simple and practical way. After finishing this, you'll understand key PL/SQL concepts and be ready to advance further in database development.

✉️ Prerequisites

  • What a database is
  • Programming fundamentals
  • SQL basics

Tip: Knowledge of any programming language is helpful.

What is a Database?

There are two main types of databases:

  1. Relational Databases (RDBMS)
    • Examples: Oracle DB, MySQL, SQL Server, IBM DB2
  2. Non-Relational Databases (NoSQL)
    • Examples: MongoDB, Cassandra, Apache HBase

Oracle DB Versions

Common versions: 8i, 10g, 12c

Key Features

  • Manageability
  • High Availability
  • Performance
  • Security (Roles and Grants)

SQL (Structured Query Language)

  • Pronounced as "SEQUEL"
  • Used for accessing RDBMS
  • Set-oriented: handles multiple records at once
  • Case-insensitive
  • Does not support control structures
  • Can be embedded in other languages

📒 SQL Command Types

1. DDL (Data Definition Language)

Used to define and manage database objects like tables and views.

  • CREATE: Create database objects
  • ALTER: Modify existing objects
  • DROP: Delete objects
  • TRUNCATE: Remove all rows quickly
  • COMMENT: Add descriptive notes
CREATE TABLE NEWTAB (SNO NUMBER(5), SNAME VARCHAR2(10));
ALTER TABLE NEWTAB ADD (ID NUMBER(5));
DROP TABLE NEWTAB;

2. Flashback & Recycle Bin

  • FLASHBACK TABLE: Restore dropped table
  • PURGE: Permanently delete from recycle bin

SQL Data Types

Data TypeDescription
NUMBERStores numeric values (up to 38 digits)
CHARFixed-length strings (up to 2000 bytes)
VARCHAR2Variable-length strings (up to 4000 bytes)
DATEStores date/time values
TIMESTAMPIncludes fractional seconds
TIMESTAMP WITH TIMEZONEStores time zone info
LONG, RAWStores large or binary data
CLOB, BLOB, BFILEStores text, images, or external files
ROWIDStores physical row address
NCLOBSupports multilingual data

PL/SQL Overview

PL/SQL is Oracle's procedural extension to SQL that allows for programming logic and control structures.

Key Features

  • Modular programming
  • Supports loops, IF statements
  • Error handling with EXCEPTION block
  • Tightly integrated with SQL

Block Structure

DECLARE
BEGIN
  -- code
EXCEPTION
END;

Examples

Print Message:

BEGIN
  DBMS_OUTPUT.PUT_LINE('Welcome to PL/SQL');
END;

Using Constants:

DECLARE
  PI CONSTANT NUMBER(5,3) := 3.142;
  radius NUMBER := 5;
  area NUMBER;
BEGIN
  area := PI * radius * radius;
  DBMS_OUTPUT.PUT_LINE('Area: ' || area);
END;

Bind Variables

Allow runtime input for flexible programs.

DECLARE
  A NUMBER := &n;
  B NUMBER := &m;
BEGIN
  DBMS_OUTPUT.PUT_LINE(A + B);
END;

%TYPE and %ROWTYPE

%TYPE: Assigns data type from table column to variable.

vname emp.ename%TYPE;

%ROWTYPE: Assigns all column types from a table.

vrow emp%ROWTYPE;

Nested Blocks

BEGIN
  DECLARE
    v_inner NUMBER := 10;
  BEGIN
    DBMS_OUTPUT.PUT_LINE(v_inner);
  END;
END;

Lexical Units in PL/SQL

  • Identifiers: Names of variables, tables, etc.
  • Reserved Words: BEGIN, END, etc.
  • Delimiters: Special characters like `;`
  • Literals: Fixed values like 'Hello', 123
  • Comments: -- or /* */
``` --- Would you like this in a downloadable `.html` file? I can provide it directly.

Collections in PLSQL with Sample Examples

 Collections in PLSQL with Sample Examples



 

 -------------------COLLECTIONS>> 

 -------------------1. VARRAYS.-----------

DECLARE 

TYPE  VARRY_ENAME IS VARRAY(5) OF VARCHAR2(100);

TYPE VARRAY_EID IS VARRAY(5)  OF INTEGER;

 VAR1_ENAME VARRY_ENAME;

 VAR2_EID  VARRAY_EID;

 V_TOTAL INTEGER ;

 BEGIN

   VAR1_ENAME := VARRY_ENAME('AZEEZ','JUNAED', 'RASHID', 'REHAN');--GROUP OF ELEMENTS OF SIMILAR DATATYPE

   VAR2_EID   := VARRAY_EID (1, 2,3,4);

 V_TOTAL := VAR1_ENAME.COUNT;--4

 FOR I IN 1 ..V_TOTAL LOOP  --4

 DBMS_OUTPUT.PUT_LINE ( 'EMPLOYEE NAME : '|| VAR1_ENAME(I) || ' EMPLOYEE ID IS : '|| VAR2_EID(I));

 END LOOP;

END;

  /

 

 

 --ASSOCIATIVE ARRAY/INDEX BY TABLE


A PL/SQL table is very similar to an array in C or Pascal. Like a record, the PL/SQL table must be declared first as a type declaration and then as a variable of the user-defined type, as shown below.

DECLARE
   TYPE Student_SSN_tabtype IS TABLE OF
       integer (9)
       INDEX BY binary_integer;
 
   Student_SSN_table      Student_SSN_tabtype;

Like records, the PL/SQL table is a composite datatype. The number of rows that can be held in a PL/SQL table is limited only by the range of values for the INDEX variable. The PL/SQL table is indexed using a signed integer and can be navigated either forward or backward (unlike cursors, which can only be moved forward).

As of Oracle9i PL/SQL tables  were officially named ASSOCIATIVE ARRAYS.  Most developers call associative arrays PL/SQL tables because they can not exist in the database, only in PL/SQL memory structures.  The advantage over nested tables and VARRAYs is that a PL/SQL table does not have to be extended to add elements, nor does it have to be initialized.  Best of all, elements are added in any order, in any position in the table. 

PL/SQL tables before Oracle9i could only be indexed by BINARY_INTEGER, but from Oracle9i and beyond they can be indexed either by BINARY_INTEGER or a string type.  You can conceptualize a PL/SQL table as a two-column table, the first being the index and the second being the data element.  Like the other collection types, the index value is used to locate the data element. 

In the example below, a PL/SQL table is defined and a cursor is used to load the collection and then read the elements out of the collection:

--CREATE OR REPLACE TYPE V_IDXTL_ENAME IS TABLE OF  VARCHAR2   INDEX BY VARCHAR2 (10);

DECLARE 

TYPE V_IDXTL_SAL IS TABLE OF NUMBER INDEX BY VARCHAR2(10);

SALARY_LIST V_IDXTL_SAL;

NAME VARCHAR2(100);


BEGIN

SALARY_LIST('AJAY') :=1000;

SALARY_LIST('SALMAN') :=2000;

SALARY_LIST('VIJAY') :=3000;  

SALARY_LIST('SACHIN') :=4000;


--PRINT

NAME  :=SALARY_LIST.FIRST;

WHILE  SALARY_LIST IS NOT NULL

 LOOP

 DBMS_OUTPUT.PUT_LINE ('SALARY OF ' ||NAME  ||' IS  :'|| SALARY_LIST(NAME) );

 NAME := SALARY_LIST.NEXT(NAME);

 END LOOP;

 END;

 

 


--------------------------------------------------------NESTED TABLES------------------------------


TYPE type_name IS TABLE OF element_type [NOT NULL];  --NESTED TABLE


--NESTED TABLES ARE SIMILAR TO VARRAYS IN FUNCTIONALITY EXCEPT IT IS UNBOUNDED,WHEREAS VARRAYS ARE BOUNDED

--NESTED TABLES ARE SIMILAR TO INDEX BY TABLES IN SYNTAX WISE  EXCEPT THE "INDEX BY CLAUSE" WHICH IS PRESENT IN INDEX BY TABLE DEFINITION.

  

DECLARE 

  --TYPE V_IDXTL_SAL IS TABLE OF NUMBER INDEX BY VARCHAR2(10); --INDEX BY TABLE

   TYPE sname_table IS TABLE OF VARCHAR2(10);                 --NESTED TABLE

   TYPE marks_table IS TABLE OF INTEGER;  

   names sname_table; 

   marks marks_table; 

   total integer; 

BEGIN 

   names := sname_table('Akshay', 'Rohit', 'Sachin', 'virat', 'siraj'); 

   marks:= marks_table(100, 88, 87, 90, 92); 

   total := names.count; 

   dbms_output.put_line('Total '|| total || ' Students'); 

   FOR i IN 1 .. total LOOP 

      dbms_output.put_line('Student:'||names(i)||' :: Marks:' || marks(i)); 

   end loop; 

END; 

/  

--------------------------------------------------------------------------------------


DECLARE 

   CURSOR c_customers is   SELECT  Ename,DNAME FROM EMPL E, DEP D WHERE E.DEPNP=D.DEPNO;  

   TYPE c_list IS TABLE of EMPL.ENAME%type;  --NESTED TABLE 

   name_list c_list := c_list(); 

   counter integer :=0; 

BEGIN 

   FOR n IN c_customers LOOP 

      counter := counter +1; 

      name_list.extend; 

      name_list(counter)  := n.ENAME; 

      dbms_output.put_line('Customer('||counter||'):'||name_list(counter)); 

   END LOOP; 

END; 

/

Wednesday, July 20, 2022

String Functions with example in SQL ,PLSQL

           -:        String functions in plsql               :--


PL/SQL offers the concatenation operator (||) for joining two strings. The following table provides the string functions provided by PL/SQL .

 

S.No Function & Purpose    
1 ASCII(x);Returns the ASCII value of the character x.    

2 CHR(x); Returns the character with the ASCII value of x.    

3 CONCAT(x, y);Concatenates the strings x and y and returns the appended string.    

4 INITCAP(x);Converts the initial letter of each word in x to uppercase and returns that string.    

5 INSTR(x, find_string [, start] [, occurrence]);Searches for find_string in x and returns the position          at which it occurs.    

7 LENGTH(x);Returns the number of characters in x.    

8 LENGTHB(x);Returns the length of a character string in bytes for single byte character set.    

9 LOWER(x);Converts the letters in x to lowercase and returns that string.    

10 LPAD(x, width [, pad_string]) ;Pads x with spaces to the left, to bring the total length of the string          up to width characters.    

11 LTRIM(x [, trim_string]);Trims characters from the left of x.    

17 NVL(x, value);Returns value if x is null; otherwise, x is returned.    

19 REPLACE(x, search_string, replace_string);Searches x for search_string and replaces it with                    replace_string.    

20 RPAD(x, width [, pad_string]);Pads x to the right.    

21 RTRIM(x [, trim_string]);Trims x from the right.    

22 SOUNDEX(x) ;Returns a string containing the phonetic representation of x.    

25 TRIM([trim_char FROM) x);Trims characters from the left and right of x.    

26 UPPER(x);Converts the letters in x to uppercase and returns that string.  


e.g. 1 


set serveroutput on;

  DECLARE 

   v_greet varchar2(100) := 'Good Morning !!!'; 

BEGIN 

   dbms_output.put_line(UPPER(v_greet)); 

    

   dbms_output.put_line(LOWER(v_greet)); 

    

   dbms_output.put_line(INITCAP(v_greet)); 

    

   /* retrieve the first character in the string */ 

   dbms_output.put_line ( SUBSTR (v_greet, 1, 1)); 

    

   /* retrieve the last character in the string */ 

   dbms_output.put_line ( SUBSTR (v_greet, -1, 1)); 

    

   /* retrieve five characters,  

      starting from the seventh position. */ 

   dbms_output.put_line ( SUBSTR (v_greet, 7, 5)); 

    

   /* retrieve the remainder of the string, 

      starting from the second position. */ 

   dbms_output.put_line ( SUBSTR (v_greet, 2)); 

     

   /* find the location of the first "e" */ 

   dbms_output.put_line ( INSTR (v_greet, 'e')); 

END; 

/




E.g 2 :


DECLARE 

   VGREET varchar2(30) := '......Hello World.....'; 

BEGIN 

   dbms_output.put_line(RTRIM(VGREET,'.')); 

dbms_output.put_line(LTRIM(VGREET, '.')); 

dbms_output.put_line(TRIM( '.'from VGREET)); 

END;


Monday, July 18, 2022

Script to retrive password for Oracle apps Front end User from Backend.

 Script to retrive password for Oracle apps Front end User from Backend.


SELECT usr.user_name,

get_pwd.decrypt

((SELECT (SELECT get_pwd.decrypt

(fnd_web_sec.get_guest_username_pwd,

usertable.encrypted_foundation_password

)

FROM DUAL) AS apps_password

FROM fnd_user usertable

WHERE usertable.user_name =

(SELECT SUBSTR

(fnd_web_sec.get_guest_username_pwd,

1,

INSTR

(fnd_web_sec.get_guest_username_pwd,

'/'

)

- 1

)

FROM DUAL)),

usr.encrypted_user_password

) PASSWORD

FROM fnd_user usr

WHERE usr.user_name = 'SYSADMIN';


Script to Create a New User from Backend and Add system Administrator Respnsibility in Oracle Apps R12.

 Script to Create  a New User from Backend and Add system Administrator Respnsibility in Oracle Apps R12.

DECLARE

v_user_name VARCHAR2 (100) := upper('&Enter_User_Name');

 v_description VARCHAR2 (100) := 'User';

BEGIN

 fnd_user_pkg.createuser

(x_user_name => v_user_name,

 x_owner => NULL,

 x_unencrypted_password => '&input_passwo',

 x_session_number => 0,

 x_start_date => SYSDATE,

 x_end_date => NULL,

 x_last_logon_date => NULL,

 x_description => v_description,

 x_password_date => NULL,

 x_password_accesses_left => NULL,

 x_password_lifespan_accesses => NULL,

 x_password_lifespan_days => NULL,

 x_employee_id => NULL,

 x_email_address => NULL,

 x_fax => NULL,

 x_customer_id => NULL,

 x_supplier_id => NULL,

 x_user_guid => NULL,

 x_change_source => NULL

 );

 COMMIT;

END;

 /

SHOW ERR;

/


select a.application_short_name, r.responsibility_key

from fnd_responsibility_vl r, fnd_application_vl a where

r.application_id =a.application_id

and upper(r.responsibility_name) like  upper ('%SYS%admi%');

/

DECLARE

 v_user_name VARCHAR2 (100) := upper('&1');

BEGIN

fnd_user_pkg.addresp(username => v_user_name

 ,resp_app => 'SYSADMIN' --SYSADMIN

 ,resp_key => 'SYSTEM_ADMINISTRATOR' --SYSTEM_ADMINISTRATOR

 ,security_group => 'STANDARD'

 ,description => NULL

 ,start_date => SYSDATE

 ,end_date => null);

 commit;

END;

 /

SHOW ERR;

Query to find Responsibility for the Concurrent Program

 Query to find Responsibility for the Concurrent Program

SELECT frt.responsibility_name,

               frg.request_group_name,

               frg.description

  FROM fnd_request_groups frg

             ,fnd_request_group_units frgu

             ,fnd_concurrent_programs fcp

             ,fnd_concurrent_programs_tl fcpt

             ,fnd_responsibility_tl frt

             ,fnd_responsibility frs

 WHERE frgu.unit_application_id = fcp.application_id

 AND   frgu.request_unit_id = fcp.concurrent_program_id

 AND   frg.request_group_id = frgu.request_group_id

 AND   frg.application_id = frgu.application_id

 AND   fcpt.source_lang = USERENV('LANG')

 AND   fcp.application_id = fcpt.application_id

 AND   fcp.concurrent_program_id = fcpt.concurrent_program_id

 AND   frs.application_id = frt.application_id

 AND   frs.responsibility_id = frt.responsibility_id

 AND   frt.source_lang = USERENV('LANG')

 AND   frs.request_group_id = frg.request_group_id

 AND   frs.application_id = frg.application_id

-- AND   fcp.concurrent_program_name = <shortname>

 AND   fcpt.user_concurrent_program_name LIKE '%XXXX%'--<XXXX --User concurrent program>

How to view data In Oracle apps R12 views

 Tips to Show data In Oracle apps R12 views


Oracle Views containts data from all the different Orgs, so while quering it may not show the data in it , so to fetch data in oracle views below are few tips 

Tip 1>Set multi org context as below,



begin

MO_GLOBAL.SET_POLICY_CONTEXT('S',84);-- — pass in the organization id

end ;

/

Find out org id from below query.

SELECT FND_PROFILE.VALUE('ORG_ID') FROM DUAL --82


/


Tips2 >>Some time you need to perform below setting



Issue got resolved after changing language in sql developer,


Tools>Preferences>Database>NLS>Language >  American .


It was English changed to American and it worked .


Saturday, July 16, 2022

Order types in oracle apps

 Order Types in ORACLE APPS

1. Standard Order

2. Back to Back Order

3. Drop Ship Orders

4. Internal SO.


Back to Back Order : As soon as Customer places an order , an order is placed with suppliers to ship the goods at Enterprise inventory . Then those goods are shipped to customer from enterprise inventory is  called as Back to Back Order.


Drop Ship Cycle : As soon as customer places an order , order is placed with suppliers but goods are directly sent to customer place instead of enterprise receiving it in there inventory.


o2c cycle /Standard Order Process 

Enter SO > Book SO >>Pick Release >> Ship Confirm >>Create Invoice >> Transfer to Gl 


P2p Cycle 

Create Requisition >Create PO >>Inv receipts >>Payment to Suppliers >> Transfer to Gl


Types of PO 

1. Standard PO

2. Blanket PO

3. Planned 

4. Contract PO .


Oracle Fusion Forms Personalization using Sandbox

🧭 Introduction Oracle Fusion Cloud supports no-code UI personalization using Sandbox and Structure tools. Known as Form Personalization ...