Wednesday, 17 February 2016

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';

Oracle Database Version

Run Below Query in Sql Developer or Toad or any tool you are using.
SELECT * FROM V$VERSION
or
SELECT version FROM V$INSTANCE
or
BEGIN DBMS_OUTPUT.PUT_LINE(DBMS_DB_VERSION.VERSION || '.' || DBMS_DB_VERSION.RELEASE); END;
Result:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

Thursday, 28 January 2016

APEX_ITEM



You can use the APEX_ITEM package to create form elements dynamically based on a SQL query instead of creating individual items page by page.

It's sometime necessary that you need to use Item(apex_item) in page,like you want show something when query runs.

Apex_Item will work same as inbuilt option of creating items with Name,Id,Class.

There are several more apex_item which will be useful.

https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_item.htm#AEAPI199

You can also check Demo which will demonstrate how you can create such items.

If Link Changes in Future then below will be some of the Apex_items you can search and use.

CHECKBOX2 Function
DATE_POPUP Function
DATE_POPUP2 Function
DISPLAY_AND_SAVE Function
HIDDEN Function
MD5_CHECKSUM Function
MD5_HIDDEN Function
POPUP_FROM_LOV Function
POPUP_FROM_QUERY Function
POPUPKEY_FROM_LOV Function
POPUPKEY_FROM_QUERY Function
RADIOGROUP Function
SELECT_LIST Function
SELECT_LIST_FROM_LOV Function
SELECT_LIST_FROM_LOV_XL Function
SELECT_LIST_FROM_QUERY Function
SELECT_LIST_FROM_QUERY_XL Function
TEXT Function
TEXTAREA Function
TEXT_FROM_LOV Function

TEXT_FROM_LOV_QUERY Function

Example:


SELECT 
    empno, 
    APEX_ITEM.HIDDEN(1,empno)||
    APEX_ITEM.TEXT(2,ename) ename, 
    APEX_ITEM.TEXT(3,job) job, 
    mgr, 
    APEX_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hd,
  FROM emp
ORDER BY 1
In above Example
--.HIDDEN item will be hidden on page(for storing Id you can use this feature)
-- .TEXT with display a text item
-- .DATE_POPUP date popup will be created

WWV_FLOWS TABLE

If you want to see all workspaces with its applications and parsing schemas, then you can select the WWV_FLOWS table in the Apex owner schema, like apex_040200 (for apex 4.2.x).

Select * from apex_040200.wwv_flows;
You need:
grant select on apex_040200.wwv_flows to parsing_schema;
if you want to see a result set.
An alternative way is to select the Apex view APEX_APPLICATIONS.
To see all workspaces you need thereby the role APEX_ADMINISTRATOR_ROLE .

Wednesday, 27 January 2016

Creating a Work-space in Oracle Apex 5.0.3

Visit : https://apex.oracle.com/en/

You can see the Below image in-front of your monitor screen if you already have Workspace then insert Credentials if not then you can request it by Clicking on "Request A Workspace".
You will get a link into your mail box(Registered) click on it you will be redirected to above link.


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 ...