Showing posts with label plsql. Show all posts
Showing posts with label plsql. Show all posts

Friday, 11 September 2020

ORA-04061: existing state of has been invalidated ORA-04061: existing state of package body "package name" has been invalidated

Ideally this error comes when the package in question is Invalid but sometime we see this error even if our package is Valid.


Instead of getting into too much details and debugging just request your DBAs to recompile the package or do it yourself if you are a confident developer with apps access ;) 


To compile both of sepc and body :-

                                Alter package pkg_name compile;


To compile only Body :-

                                Alter package pkg_name compile body;

If its recompiled without any error then just retest.

That's it.



Thursday, 5 July 2018

PL SQL Vs SQL


PL Sql vs Sql

Comparison
SQL
PL/SQL
Execution
Single command at a time
Block of code
Application
Source of data to be displayed
Application created by data aquired by SQL
Structures include
DDL and DML based queries and commands
Includes procedures, functions, etc
Recommended while
Performing CRUD operations on data
Creating applications to display data obtained using sql
Compatibility with each other
SQL can be embedded into PL/SQL
PL/SQL cant be embedded in SQL

Sunday, 1 October 2017

Concatenate ROWDATA into one column

We all are aware of concatenating multiple column data into one column but when it comes to concatenating multiple rows into one column we always start looking for an answer on the net.

Here I have the solution for both :-


Concatenate Columns into one column:-

SELECT organization_id,
       BUSINESS_GROUP_ID,
       CONCAT (organization_id, BUSINESS_GROUP_ID)
  FROM hr_All_organization_units
 WHERE organization_id IN (81, 82, 83);


Concat Rows into one Column:-

SELECT LISTAGG (organization_id, ';') WITHIN GROUP (ORDER BY organization_id)
          organization_id,
       LISTAGG (BUSINESS_GROUP_ID, ';')
          WITHIN GROUP (ORDER BY BUSINESS_GROUP_ID)
          BUSINESS_GROUP_ID
  FROM hr_All_organization_units
 WHERE organization_id IN (81, 82, 83);