Saturday, 20 February 2016

Find table size and set column size

Find table size :

 select segment_name,segment_type,bytes/1024/1024 MB
 from dba_segments
 where segment_type='TABLE' and segment_name='<yourtablename>';

Set column size :

sql>column column_name format a30
sql>set linesize 300

Cheers.

Wednesday, 17 February 2016

Redirect to the previous page

When there are multiple pages and you want to be redirected to the the page where you redirected from then you need to do following steps.

I have three pages 1,2,3. and three buttons page1,page2,page3.

Now when i click on button page1 of page 1 then it should redirect me to the page3 and from page3's button if i click on same time then it should redirect me to page1(It's caled Previous page) and same for the page2 if i click of button page2 of page2 then it should redirect me to the page3,on same time if i click on page3's button then it should redirect me to page 2(page2 will be previous page this time).

Create One Hidden item on page 3 : P3_PREVIOUS_PAGE

On page 1 and 2 create branch to redirect to page 3 and in set values of branch put P3_PREVIOUS_PAGE and page value.

For page 1 branch  Item Name = P3_PREVIOUS_PAGE set this value = 1
for page 2 branch item name = P3_PREVIOUS_PAGE set this value = 2

or

You can create a Global page and item in it Call P0_PREVIOUS_PAGE and result will be same.

 LinkedIN


Understanding URL Syntax



You can create links between pages in your application using the following syntax:


f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

Description:

App :  Application ID
Page : Page ID
Session :Identifies a session ID. You can reference a session ID to create hypertext links to other pages that maintain the same session state by passing the session number. 
Request : Sets the value of REQUEST. Each application button sets the value ofREQUEST to the name of the button which enables accept processing to reference the name of the button when a user clicks it
Debug : Displays application processing details. Valid values for the DEBUG flag include YES,NO,LEVELn
itemNames : Comma-delimited list of item names used to set session state with a URL.
itemValues : List of item values used to set session state within a URL. Item values cannot include colons, but can contain commas if enclosed with backslashes. To pass a comma in an item value, enclose the characters with backslashes.
PrinterFriendly : Determines if the page is being rendered in printer friendly mode. If PrinterFriendly is set to Yes, then the page is rendered in printer friendly mode. The value of PrinterFriendly can be used in rendering conditions to remove elements such as regions from the page to optimize printed output. 
https://docs.oracle.com/database/121/HTMDB/concept_url.htm#HTMDB03025

v('') Vs. apex_application.globalvariable

As i describe in Previous post their are list of global variable which we can use in pl/sql aslo.
Now, Problem is v(' '); is not fix oracle apex may change it in future as they have done it in past so better approach will be use it as apex_application.globalvariable for that i have created a Function as shown below(change it as per need).

Function :

CREATE OR REPLACE FUNCTION GET_CUSTOMERNAME(custid Number) RETURN VARCHAR2 IS
tmpVar VARCHAR2(200);

BEGIN
 
     SELECT FIRST_NAMEINTO tmpVar FROM CUSTOMER WHERE CUST_ID = custid
   and cmp_id = apex_application.g_user;
   RETURN tmpVar;
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END GET_CUSTOMERNAME;
/

Global Variables in apex oracle 5.0

List of global variables :

G_USERSpecifies the currently logged in user.
G_FLOW_IDSpecifies the ID of the currently running application.
G_FLOW_STEP_IDSpecifies the ID of the currently running page.
G_FLOW_OWNERSpecifies the schema to parse for the currently running application.
G_REQUESTSpecifies the value of the request variable most recently passed to or set within the show or accept modules.
G_BROWSER_LANGUAGERefers to the Web browser's current language preference.
G_DEBUGRefers to whether debugging is currently switched on or off. Valid values for the DEBUG flag are 'Yes' or 'No'. Turning debug on shows details about application processing.
G_HOME_LINKRefers to the home page of an application. The Application Express engine will redirect to this location if no page is given and if no alternative page is dictated by the authentication scheme's logic.
G_LOGIN_URLCan be used to display a link to a login page for users that are not currently logged in.
G_IMAGE_PREFIXRefers to the virtual path the web server uses to point to the images directory distributed with Oracle Application Express.
G_FLOW_SCHEMA_OWNERRefers to the owner of the Application Express schema.
G_PRINTER_FRIENDLYRefers to whether or not the Application Express engine is running in print view mode. This setting can be referenced in conditions to eliminate elements not desired in a printed document from a page.
G_PROXY_SERVERRefers to the application attribute 'Proxy Server'.
G_SYSDATERefers to the current date on the database server. this uses the DATE DATATYPE.
G_PUBLIC_USERRefers to the Oracle schema used to connect to the database through the database access descriptor (DAD).
G_GLOBAL_NOTIFICATIONSpecifies the application's global notification attribute.

Tuesday, 16 February 2016

Find column name of a particular string

So, basically when you need to find a particular column string from all the available table then its kind of lengthy process if you look into every table for particular column string so below query will make works more easier.

select table_name from dba_tab_columns where column_name='THE_COLUMN_YOU_LOOK_FOR';
Without DBA privileges:
select table_name from all_tab_columns where column_name='THE_COLUMN_YOU_LOOK_FOR';

Show values in right side of shuttle

While working with select list and shuttle, when we want to display values into right side of shuttle depending upon selection from select ...