Monday, February 11, 2013

Calling new form from the current oracle form.


Calling another form by pressing button in main form:-

Create a button in the current form.On its when-button-pressed trigger write the below code to call another form.
One can pass parameter  also from one form to another.

declare
the_param      varchar2(10);
   pl_id          paramlist;
   the_code       varchar2(10);
 

begin

  :System.Message_Level := 25;
  POST;  
  :System.Message_Level :=0;
  The_Param:='pram1';
  pl_id := Get_Parameter_List(The_Param);
  if not Id_Null(pl_id) then
     Destroy_Parameter_List( pl_id );
  end if;
  pl_id := create_parameter_list(the_param);


      add_parameter(pl_id,'P_QUERY',text_parameter,:PARAMETER.P_QUERY);
 
call_form('new_form_name',hide,no_replace,no_query_only,pl_id);


end;

also we can open the new form in query only mode by replacing "no_query_only" value to "query_only".

Sunday, February 10, 2013

How to select last two rows of an Oracle table?


select * from (
select ROW_NUMBER()
   OVER (PARTITION BY employee_name ORDER BY emp_code desc) rnum,emp_code from your_table where employee_name='Test'
)
where rnum<=2

How to initialize a date field to system date in oracle forms?

do you want initialize a date in text item?

if so,

Set initial value $$dbdate$$

or 

Set initial value to $$date$$