Thursday, 23 July 2015

Convert Vertical records to Horizontal -Query

SQL> select * from test_table;
METRIC     CURRENTVAL LASTVALUE  AVERAGEVAL TREND
---------- ---------- ---------- ---------- ----------
Metric1    10%        20%        30%        UP
Metric2    30%        20%        10%        DOWN
Metric3    10%        10%        10%        UNCHANGED
Metric4    10%        20%        10%        Variable
Metric5    30%        60%        90%        UP

SQL> with
  2    lines as (select level line from dual connect by level <= 5),
  3    cols as (select level col from dual connect  by level <= 5)
  4  select max(decode(col, 1,
  5                    decode(line, 1, metric,
  6                                 2, CurrentValue,
  7                                 3, lastvalue,
  8                                 4, AverageValue,
  9                                 5, trend))) col1,
 10         max(decode(col, 2,
 11                    decode(line, 1, metric,
 12                                 2, CurrentValue,
 13                                 3, lastvalue,
 14                                 4, AverageValue,
 15                                 5, trend))) col2,
 16         max(decode(col, 3,
 17                    decode(line, 1, metric,
 18                                 2, CurrentValue,
 19                                 3, lastvalue,
 20                                 4, AverageValue,
 21                                 5, trend))) col3,
 22         max(decode(col, 4,
 23                    decode(line, 1, metric,
 24                                 2, CurrentValue,
 25                                 3, lastvalue,
 26                                 4, AverageValue,
 27                                 5, trend))) col4,
 28         max(decode(col, 5,
 29                    decode(line, 1, metric,
 30                                 2, CurrentValue,
 31                                 3, lastvalue,
 32                                 4, AverageValue,
 33                                 5, trend))) col5      
 34  from lines, cols,
 35       (select rownum rn, test_table.* from test_table)
 36  where rn = col
 37  group by line
 38  order by line
 39  /
COL1       COL2       COL3       COL4       COL5
---------- ---------- ---------- ---------- ----------
Metric1    Metric2    Metric3    Metric4    Metric5
10%        30%        10%        10%        30%
20%        20%        10%        20%        60%
30%        10%        10%        10%        90%
UP         DOWN       UNCHANGED  Variable   UP

Datatype Conversions


String to Int

 String get_user_id_count = '123';    
 Number get_user_id_count_n = new Number(get_user_id_count);
 int count=(get_user_id_count_n).intValue();

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

Int to Number

int value = 0;
oracle.jbo.domain.Number num = new oracle.jbo.domain.Number(value);

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

Compile CUSTOM.pll and Oracle FORM

To Compile CUSTOM.pll

PREQUISIT:
1) Set Environment variable
2) Run above command in $AU_TOP/resource

Use below command:
frmcmp_batch module=CUSTOM.pll userid=apps/<pwd> output_file=CUSTOM.plx module_type=LIBRARY batch=yes compile_all=special

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

To Compile FORM
Go to path where .fmb is present

Use below command:
frmcmp_batch userid=apps/apps module=<FORM_NAME.fmb> output_file=<FORM_NAME.fmx> module_type=form compile_all=special

or

frmcmp_batch module=<FORM_NAME.fmb> userid=apps/apps output_file=<FORM_NAME.fmx> module_type=form batch=yes compile_all=special


CO code to remove links on OAF page - Like Home,Logout

In PR

OAPageLayoutBean page = pageContext.getPageLayoutBean();
page.prepareForRendering(pageContext);
OAGlobalButtonBarBean buttons =(OAGlobalButtonBarBean)page.getGlobalButtons();
buttons.setRendered(false);

CEMLI performance checker

Concurrent Program:   CEMLI performance checker
Its output is the report containing result based on performance of all the concurrent program with Trace enable (Result is PASS/FAIL).

1. create any (say 5) concurrent program whose performance needs to be checked make it (all)Trace enable
2. Run those concurrent programs one-by-one
3. Now at end run the CEMLI performance checker
4. view the log file, in that log file at end their is an URL where we can find the Performance report of our concurrent programs
5. copy-paste the URL in Browser (We have the required report)


Set FORMS_PATH in putty

applprod@xxo00005:/u02/R12/EBSPRD/fs1/EBSapps/appl/xxcustom_top/12.0.0/forms/US$ export FORMS_PATH=$FORMS_PATH:$AU_TOP/forms/US

Bouncing Appache

This is specially for OAF Developers, who frequently needs to bounce appache / oacore to refresh OAF pages

Set environment variable, use below command in putty
ps -ef | grep tns
Command output will be like
/u02/R12/EBSPRD/fs1/EBSapps/10.1.2/bin/tnslsnr APPS_EBSPRD -inherit

cd /u02/R12/EBSPRD/

 . EBSapps.env run

This would set environment variable

------

In R12.2.X We need to bounce oacore, below commands to be executed from putty,
admanagedsrvctl.sh stop oacore_server1
admanagedsrvctl.sh start oacore_server1
(here we would need Weblogic password)

or we can bounce oacore from front end by login as weblogic user in console
http://<host_name>:7002/console/

Environment-->Servers-->Control-->click on oacore_server1-->Shutdown(Force Shutdown Now)-->ok
Environment-->Servers-->Control-->click on oacore_server1-->Start-->ok

------

In R12.1.X We need to start stop 2 scripts
adapcctl.sh
adoacorectl.sh

search below tops in putty to find above 2 scripts
$APPL_TOP
$CUSTOM_TOP
$ADMIN_SCRIPTS_HOME
$INST_TOP

>adapcctl.sh stop
>adoacorectl.sh stop
>adoacorectl.sh start
>adapcctl.sh start
--------

In 11i we only need to bounce appache
>adapcctl.sh stop
>adapcctl.sh start