Tuesday, October 29, 2013

Questions Related to Versions and Instance names of Database and EBS

1).To Get versions
SELECT SUBSTR(product,1,15) product,SUBSTR(version,1,15) version,SUBSTR(status,1,15) status
FROM product_component_version;
2).To Get Version
select * from v$version where banner like 'Oracle%';
3).To Get  Applications/Versions/Patch Levels
select   substr(a.APPLICATION_NAME,1,60) "Application Name"
,  substr(i.PRODUCT_VERSION,1,4)  "Version"
,  i.PATCH_LEVEL    "Patch Level"
,  i.APPLICATION_ID   "Application ID"
,  i.LAST_UPDATE_DATE   "Last Update"
from   APPS.FND_PRODUCT_INSTALLATIONS  i
,  APPS.FND_APPLICATION_ALL_VIEW  a
where   i.APPLICATION_ID   = a.APPLICATION_ID
order by a.APPLICATION_NAME
4). To Get objects under owner APPS (PKG,Views)
select owner,object_name,object_type from dba_objects where owner='APPS';
5).To Get server,instance or machine using ?
SELECT name FROM v$database;
select instance_name from v$instance;
select * from global_name;
SELECT VALUE FROM V$PARAMETER WHERE NAME='db_name';
select to_number(translate(substr(version,1,9),'1.$','1')) from v$instance;
select s.machine from v$session s where s.audsid = userenv('sessionid');
select global_name from global_name;
select sys_context('USERENV','DB_NAME') AS instance from dual;
select substr(release_name,1,7) Version,
    substr(rpad(MULTI_ORG_FLAG,2,' '),1,2) "MO",
    substr(rpad(MULTI_CURRENCY_FLAG,3,' '),1,3) "MRC"
    from apps.fnd_product_groups;
8).To Get Random Numbers
select dbms_random.random from dual;
9).To See wether multi org flag is set or not ?
select multi_org_flag from fnd_product_groups;

10). To get Patches levels
SELECT fa.application_short_name app,
  fpi.patch_level
FROM fnd_product_installations fpi,
  fnd_application fa
WHERE fa.application_id = fpi.application_id;
         (or)
 SELECT * FROM ad_applied_patches;

Thursday, October 24, 2013

Initializing apps

DECLARE
   L_APPL_ID             number;
   l_appl_name           VARCHAR2 (100) := 'PER';
   L_USER_ID             number;
   l_user_name           VARCHAR2 (100) := 'XX_ADMIN';
   l_responsibility_id   NUMBER;
   l_resp_name           VARCHAR2 (200) := 'US Super HRMS Manager';
BEGIN

-- To get the Application ID of given Application.
   SELECT application_id
     INTO l_appl_id
     FROM fnd_application
    WHERE application_short_name = l_appl_name;

-- To get the User ID information of  given user
   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name = l_user_name;

-- To get the Resp ID information of the given responsibility.
   SELECT responsibility_id
     INTO l_responsibility_id
     FROM fnd_responsibility_tl
    WHERE responsibility_name = l_resp_name AND application_id = l_appl_id;

--Initialixze the Application to use the API.
   fnd_global.apps_initialize (l_user_id, l_responsibility_id, l_appl_id);
END;

Tuesday, October 8, 2013

How to format XML in Notepad++?

I have notepad++ and I got some XML code which is very long. When I pasted it in Notepad++,
there is a long line of code.(difficult to read and work with.)
Now, I want to know if there is a simple way to make the text readable. (by readable I mean properly tabbed code)

Here is the solution follow the process.
--plugins --plugin manager --show plugin manager --check XML tools
--install
--restart NOTEPAD++
--open xml file --plugins --XML tools --pretty print(xml only -- with line breaks)