Answer Posted / janardhanreddy
Macro: It is a collection of SQL queries preferably DML statments and it is stored as an object in DD(Data Dictionary). Unlike VIEWS (we will deal about Views in another post), a macro can have multiple sequels. It is known that a macro can handle many DML and it is restricted to only one DDL.
Reason: DDL statements like Create,Alter,Drop,Rename generally locks the DD for their processing, since macros transaction is an internal process it is highly dependent on DD. Therefore DDL can be last statement in a macro. - This is what provided as theoretical explanation .
Example:
CM AS // CM doesnt work with Queryman better try with BTEQ
or
CREATE MACRO MyMacroName AS
(
insert into (eno,name,ereqno) emp values (101,'Rajesh',43243259);
select * from emp;
//DDL stmt here (doesnt work with queryman)
)
Issue: There is an issue with macro that, DDL couldnt be even as last statement in a macro(with Queryman). I used Teradata 12 and I am getting Warning as Data Dictionary must be solitary. I will update after working with BTEQ.
Parameterized Macro:
//paramNum is passed as Parameter to Select statement.
//passed parameter shd be accessed using =:paramname
CREATE MACRO macro_name (paramNum integer) AS
{
DMLs here....
select ename,esal from emp where eno = :paramName ;
};
REPLACE Macro:
If you require more DMLs to be added to an existing macro, you can use
REPLACE MACRO AS
{[insert];
[update];
[delete];
[select];);
To Execute Macro:
EXEC []
eg: exec myfirsmacro_name;
exec myfirsmacro_name (invalue=1,invalue='abc');
To Drop:
DROP MACRO macro-name;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the guidelines to be followed while using union transformation?
What is Story point Estimation ? Can any one give just an introduction about this ? Advance Thanks
How do you load unique records into one target table and duplicate records into a different target table?
Explain your project of banking domian.
how to load rows into fact table in data warehouse
Explain why we use partitioning the session in informatica?
How do you remove duplicate records in informatica? And how many ways are there to do it?
What are the types of caches in lookup?
Suppose we configure sorter transformations in the master and detail pipelines with the following sorted ports in order: item_no, item_name, price. When we configure the join condition, what are the guidelines we need to follow to maintain the sort order?
What are the components of workflow manager?
Informatica Server and Client are in different machines. You run a session from the server manager by specifying the source and target databases. It displays an error. You are confident that everything is correct. Then why it is displaying the error?
I am new to informatica and learning it,can anybody please tell me how we receive source as flat file in informatica,from where we get this flat file?
Write the unconnected lookup syntax?
What is native users?
Design a mapping to get the pervious row salary for the current row. If there is no pervious row exists for the current row, then the pervious row salary should be displayed as null.