Saturday, 25 May 2013

How to Configure Email Task In Informatica With Examples

Email task is used to send emails while running the workflow.Using email task we can get failure and success notifications
To explain this lets take the example of a workflow with two sessions.Session1 and Session2

a)Go to create task and create an Email Task and name it as Test_email

b)Also Enter the following details
  • Email User Name : 
  • Email subject   :
  • Email text:

Email User Name either you can hard code with an email id or give a workflow variable.To give Workflow variable, goto the workflow variable and create a new one to hold email address $$Email_Failure   



c)You can give value to workflow variable using parameter File
Emails in the Parameter file
[Richard.Workflow:wkfTest]
$$Email_Failure=xyz@mail.com


d)Also make the email task as resuable so that we can use it in multiple sessions.

e)To attach files through Email use the below codes in Email Text

  • %a<>To attach file, Absolute path need to be given <>.
  • %s Session name
  • %e Session status
  • %b Session start time
  • %c Session completion time
  • %i Session elapsed time
  • %l Total records loaded
  • %r Total records rejected
  • %t Target table details
  • %m Name of the mapping used in the session
  • %n Name of the folder containing the session
  • %d Name of the repository containing the session
  • %g Attach the session log to the message


1)To add Email Task via session Level
Go to each session and Components level give the On Failure Email as Test_Email, also give Type as Reusable and Save.This will trigger the email for Failure




2)To add Email Task via Workflow level
Goto workflow and in the Suspension Email enter the Email task name, Also give Suspend on Error and save



Friday, 10 May 2013

How to Create a Procedure with both IN and OUT Parameter

In  this post I will try to explain how to create a procedure with both Input and output Parameter


Out parameter:  The out parameter mode is used to return values to the caller of the subprogram. 
In parameter: The in parameter mode is used to pass values to the subprogram.

First Let’s Create a table order_details
SQL> create table ORDER_DETAILS
  2  (ordno varchar2(12),
  3  itemcode varchar2(12),
  4  qtyord number,
  5  qtydeld number);

Table created.

SQL> INSERT INTO  ORDER_DETAILS  VALUES('1','ITEM4',300,300);

1 row created.

SQL> INSERT INTO  ORDER_DETAILS  VALUES('5','ITEM1',200,200);

1 row created.

SQL> INSERT INTO  ORDER_DETAILS  VALUES('7','ITEM1',300,200);

1 row created.

SQL> INSERT INTO  ORDER_DETAILS  VALUES('13','ITEM4', 20, 20);

1 row created.

SQL> INSERT INTO  ORDER_DETAILS  VALUES('31','ITEM2',300,300);

1 row created.


Below is the procedure which will pass the input parameter into the procedure as well as output the result into an initialized variable


SQL> ed
Wrote file afiedt.buf

  1  create or replace procedure ORDERDETAILS(orno in varchar2,b in out varchar2
)
  2  is
  3  qtyor number;
  4  qtydel number;
  5  code varchar2(5);
  6  begin
  7  select QTYORD,QTYDELD,ITEMCODE into qtyor, qtydel, code from ORDER_DETAILS
 where ORDNO=orno;
  8  if qtydel < qtyor then
  9  b:= code;
 10  dbms_output.put_line('You supply less than what is ordered   '||b);
 11  elsif qtydel > qtyor then
 12  b:= code;
 13  dbms_output.put_line('You supply more than what is ordered   '||b);
 14  else
 15  b:=code;
 16  dbms_output.put_line('NOTHING WRONG WITH THE SUPPLY   '||b);
 17  end if;
 18  exception
 19  when no_data_found then
 20  dbms_output.put_line('no data returned');
 21  when TOO_MANY_ROWS then
 22  dbms_output.put_line('MANY ITEMS WITH SAME ITEMCODE');
 23  when OTHERS then
 24  dbms_output.put_line('SOME OTHER ERROR');
 25* end ORDERDETAILS;
 26  /

Procedure created.



After successful compilation of the procedure we can execute the same by passing the parameters
Executing the Procedure with intialized variable:

SQL> set serveroutput on;
SQL>  DECLARE
  2    var varchar2(10):='123';
  3    begin
  4    ORDERDETAILS('23',var);
  5    end;
  6  /
no data returned

PL/SQL procedure successfully completed.


SQL>  DECLARE
  2    var varchar2(10):='232';
  3    begin
  4    ORDERDETAILS('7',var);
  5    end;
  6  /
You supply less than what is ordered   ITEM1

PL/SQL procedure successfully completed.

Please let me know if you want to know how to execute the same procedure using initialized variables

Thursday, 9 May 2013

PROCEDURAL PARAMETER MODES IN PLSQL

There are three modes, which tells the compiler, how to treat the actual parameters, used during call.


1.They are IN, OUT AND IN OUT.

2.The default is IN PARAMETER (calls are by reference)
  • Take values from calling environment.
  • Behaves like constant [during exec, sub-prog cant change value]
  • Actual parameter can be literals, expressions, or constants.
  • Can be assigned default values.

3.   OUT PARAMETER (calls are by value)
  • Must be specified, returns a value to calling environment.
  • Behaves like uninitialized variable.
a)Uninitialized variables hold nulls.
b)During exec, sub-program shall change value.
c)During exec, if not changed a null is returned to caller.
  • Actual parameter must be a variable. [Cannot be constant]
  • Cannot be assigned default values.

4.   IN OUT PARAMETER (calls are by value.)
  • Must be specified,
a)Shall take values from caller / returns a value to caller.
  • Behaves like initialized variable.
    a)Uninitialized variables hold nulls.
    b)During exec, sub-program shall change value.
    c)During exec, if not changed a old is returned to caller.
    d)Actual parameter must be a variable. [cannot be constant]
  • Actual parameter must be a variable. [cannot be constant]
  • Cannot be assigned default values. 

Note:To improve performance out and in out can be given a compiler hint no copy, requesting the compiler to pass by reference.
Related Posts Plugin for WordPress, Blogger...

ShareThis