May 10, 2011

Difference between Transulate and Replace

REPLACE:
Replaces a character sequence in a string with a different set of characters.
TRANSLATE:
Translates single characters in a string to different characters.
e.g:
SELECT TRANSLATE('So What', 'aht', 'e') FROM dual;


SELECT REPLACE('So What', 'o', 'ome')FROM dual;




May 9, 2011

Conditional Selection

1.Displaying set if records:
e.g:10 records per page
Declare Global Variable called ‘no_of_Count_per_page’ -- In this case I have fixed 10 lines per page.
xsl:variable name="no_of_lines_per_page" select="number(10)"
2.Calling a inner group:
?for-each:$inner_group?
Can specify any if loop before calling the inner group
--if:position()>=$first_rec and position()<$first_rec+$no_of_Count_per_page?> --
3.Can call another template using xsl:call-template








May 3, 2011

Exception Handling

PL/SQL Exception message consists of three parts.
1) Type of Exception
2) An Error Code
3) A message

3) Types of Exception.
There are 3 types of Exceptions.
a) Named System Exceptions
b) Unnamed System Exceptions
c) User-defined Exceptions

a) Named System Exceptions :Like NO_DATA_FOUND ZERO_DIVIDE,CURSOR_ALREADY_OPEN,INVALID_CURSOR,TOO_MANY_ROWS.
These are not declared explicitly, raised implicitly when a predefined Oracle error occurs.
e.g:
BEGIN 
select * from per_all_people_f where employee_number=100;
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
dbms_output.put_line ('A SELECT...INTO did not return any row.'); 
END; 
b) Unnamed System Exceptions:These exception are user defined once.We can assosiate this to oracle error code using a pragma statement EXECEPTION_INIT
e.g:
Declare
  exception_name EXCEP_1;
PRAGMA 
EXCEPTION_INIT ( EXCEP_1,-2292); /* The erroe code range from range from -20000 to -20999 are user-defined*/

BEGIN
select * from per_all_people_f where employee_number=100;
EXCEPTION
WHEN EXCEP_1 THEN
dbms_output.put_line ('A SELECT...INTO did not return any row.');
END;
c) User-defined Exceptions:this is the condition where the user need to check for occurance of a exception while validating large number of data.Need to define and Raise the exception explicitly.
e.g:
Declare
exception_name EXCEP_1;
BEGIN
select * from per_all_people_f where employee_number=100;
Raise EXCEP_1;
exception
WHEN EXCEP_1 THEN
dbms_output.put_line ('A SELECT...INTO did not return any row.');
END;

RAISE_APPLICATION_ERROR ( ) :

We can relate the user defined exception to the predefine errcode of oracle using raise_application_error.
the advabtage if using this is all previous transactions which are not committed within the PL/SQL Block are rolled back automatically.And to make to make the user-defined exception look like an Oracle error.

Syntax:
RAISE_APPLICATION_ERROR (error_number, error_message);

/* The Error number must be between -20000 and -20999 */































Life cycle of AR,AP,GL

Starts from supplier->invoice->validate->payment->createje->post to gl->cash basis

Have a look at

http://oracleappscommunity.com/oracle/blog/modules/oracle-accounts-receivables/page/2/


May 1, 2011

ADF Sample

Simple example:

-Open jdev and check for database connection
Create a application-Click on file->new->select ADF Business Components->Choose business Components for tables


Give the package name as Demo.model
and click on query button
Select the table u wish to modify

Add the the selected tables to the right side by clicking on > direction arrows

Add updateable views in next step


Skip read only objects step.Click finish as it will load the default options.


Under appmodule package created -(which will be in the navigator window)you will find the tablename.xml extension as in the image given below.Double click on it.

Double on any column you want to change and click on validation



Validation->New
Rule type-Range
min value 0 and max value is 200

Apply and click ok.(cab chage the default date dype under UI Hints format type)
Close all and save

ref to http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm


COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...