Wednesday, 9 July 2014

REGEXP_COUNT


REGEXP_COUNT


Purpose
REGEXP_COUNT complements the functionality of the REGEXP_INSTR function by returning the number of times a pattern occurs in a source string. The function evaluates strings using characters as defined by the input character set. It returns an integer indicating the number of occurrences of pattern. If no match is found, then the function returns 0.
  • source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the datatypes CHAR,VARCHAR2NCHARNVARCHAR2CLOB, or NCLOB.
  • pattern is the regular expression. It is usually a text literal and can be of any of the datatypes CHARVARCHAR2NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the datatype of pattern is different from the datatype of source_char, then Oracle Database converts pattern to the datatype ofsource_char.
REGEXP_COUNT ignores subexpression parentheses in pattern. For example, the pattern '(123(45))' is equivalent to '12345'. For a listing of the operators you can specify in pattern, refer to Appendix C, "Oracle Regular Expression Support".
  • position is a positive integer indicating the character of source_char where Oracle should begin the search. The default is 1, meaning that Oracle begins the search at the first character of source_char. After finding the first occurrence of pattern, the database searches for a second occurrence beginning with the first character following the first occurrence.
  • match_param is a text literal that lets you change the default matching behavior of the function. You can specify one or more of the following values formatch_param:
    • 'i' specifies case-insensitive matching.
    • 'c' specifies case-sensitive matching.
    • 'n' allows the period (.), which is the match-any-character character, to match the newline character. If you omit this parameter, then the period does not match the newline character.
    • 'm' treats the source string as multiple lines. Oracle interprets the caret (^) and dollar sign ($) as the start and end, respectively, of any line anywhere in the source string, rather than only at the start or end of the entire source string. If you omit this parameter, then Oracle treats the source string as a single line.
    • 'x' ignores whitespace characters. By default, whitespace characters match themselves.
If you specify multiple contradictory values, then Oracle uses the last value. For example, if you specify 'ic', then Oracle uses case-sensitive matching. If you specify a character other than those shown above, then Oracle returns an error.
If you omit match_param, then:
    • The default case sensitivity is determined by the value of the NLS_SORT parameter.
    • A period (.) does not match the newline character.
    • The source string is treated as a single line.
Examples
The following example shows that subexpressions parentheses in pattern are ignored:
SELECT REGEXP_COUNT('123123123123123', '(12)3', 1, 'i') REGEXP_COUNT
   FROM DUAL;

REGEXP_COUNT
------------
           5
In the following example, the function begins to evaluate the source string at the third character, so skips over the first occurrence of pattern:
SELECT REGEXP_COUNT('123123123123', '123', 3, 'i') COUNT FROM DUAL;

     COUNT
----------
         3
Top of Form

Bottom of Form

Tuesday, 8 July 2014

Difference between $,$$,$$$ in Informatica



1. $ refers
These are the system variables/Session Parameters like $Bad file,$input
 
file, $output file, $DB connection,$source,$target etc..

2.$$  referes
User defined variables/Mapping Parameters like $$State,$$Time, $$Entity, $$Business_Date, $$SRC,etc.


3.$$$ refers
System Parameters like $$$SessStartTime
$$$SessStartTime returns the initial system date value on 
the machine hosting the PowerCenter Server when the server
 
initializes a session. $$$SessStartTime returns the session
 
start time as a string value. The format of the string
 
depends on the database you are using.
$$$SessStartTime returns the session start time as a string value --> The format of the string depends on the database you are using
SESSSTARTTIME is stored as a transformation date/time datatype value.
SESSSTARTTIME is used in the internal Informatica expression language, e.g. in an expression, aggregator, filter, router, etc.

Informatica Interview Questions

Informatica Interview Questions those I faced...

-- hari in ibm, praveen plsql in accenture

1) what are the conditions we required to join two tables?
2) how did you schedule your workflow ? did you used any tool?
3) Do you know SCD type IV
4) What is Mapplet?
5) What is Mapping ?
6) Diff between Mapplet & Mapping ?
7) Did you wrote any Procedures in your Project ? what reason ?
8) what type of testings you have done?
9) what is session?
10) explain you project?
11) what is a view? types ?
12) what is the diff between procedure ,function, package
13) why we are using (in, out, inout) in procedure?
14) while using lookup we need to change the lookup condition repeatedly...but it won't allows     you what is the probelm guess?
15) some questions on sequence genarator?
16) diff between OLTP OLAP
17) how to generate sequence no with out using sequence generator?
18) What you have done in your project ?
19) why u are interested in plsql job bcoz you have etl exp ?
20) diff between functions and procedure & packages ?
22) what is trigger where you used in project ?
24) have you used exception handling in your project what purpose ?


-- praveen in capgemini 2nd round for informatica

sql
---
18) diff between truncate,drop,delete
19) can we do insert and update at a time
20) what is trigger


unix
----
21) how to get only top row?
22) how to get 51-60 records?
23) how to load last 10 records?
24) what is GREP,SED
25) shell program to add two numbers

informatica
-----------
26) update strategy types(DD_update,DD_insert,DD_DELETE,D_REJECT)
27) without update strategy can we update the target
28) lookup cache, types of cache, difference's between cache's?
29) Normalizer transformation why it is using
30) DATAMART,DATAWAREHOUSE differences?
31) what is tracing?
32) what is target load ordering?
33) constraint base loading?
34) conncted,unconnected lookup diff? how you can call unconnected lookup?
35) what are the transformations you used in your project?
36) tell me about your role, responcibilities in project ?and tell me about your self?
37) how many dimension,fact tables are there in your project?

-- praveen in capgemini 3rd round hp client round:-

1) in a router t/f having 2 groups and conitioned sal >= 2000 for first group & sal <= 2000 for  second group what hapen when we run the mapping..
2) create a trigger for select statement
3) how did you done validation in your project ?
4) what is the order of port's exicution
5) difference between dynamic and lookup cache ?
6) what you have done for performence increase in your mapping ?
7) how did you validate the source & target data in case of testing ?
8) scenario : you have set treat source as " update "
              and used update else insert in session level
              what happens?

I've said it will update if match found other wise it will insert

9) how can you match the data if you are not using lookup t/f?
10) what is persistence cache ?
11) i have 100 flatfiles of same structure. how can i load all at a time ?
ans:- indirect loading using parameter file and paths

12) push down optimisation
13) have you done partitioning
14) what is paralalisim

-- praveen in capgemini 4th round hp client round:-

1.have you worked with xml files?
2.what is rowid,  and how you workout this in both mysql and oracle?
3.did you worked on partitioning?
4.what is batch
5.what type of files you used
6.what is pushdown
7.how to remove duplicate records
8.what is factless fact tables?
9.how to load first max sal,2nd max sal to target?
10.scenario: simple mapping if match found update else insert and without update strategy  t/f

-- praveen ust global questions:-

1) tell me about your project
2) can we update a target flat file with update t/f?
3) what are the target types we can update?
4) with out update strategy can we update target?
5) which tables we do load first dimensions or fact's?

-- icreative telephonic

1.can we join a meterialized view and a table?
2.structure of a stored procedure?
3.did you think that you done any thing that cant done by other's?
4.did you faced any complexity in your project?
5.what is tablespace?
6.what are the query types are there? //subquery,inline query,simple query,corelated subquery,
7.diff between inline and subquery?
8.what are the types of subqueries?
9.difference between having and where?
10.types of triggers,corsurs?
11.what is source qualifer tf?

Normalizer Related Questions



Normalizer Related Questions
Q3. Suppose in our Source Table we have data as given below:
Student Name
Maths
Life Science
Physical Science
Sam
100
70
80
John
75
100
85
Tom
80
100
85
We want to load our Target Table as:
Student Name
Subject Name
Marks
Sam
Maths
100
Sam
Life Science
70
Sam
Physical Science
80
John
Maths
75
John
Life Science
100
John
Physical Science
85
Tom
Maths
80
Tom
Life Science
100
Tom
Physical Science
85
Describe your approach.
Ans. Here to convert the Rows to Columns we have to use the Normalizer Transformation followed by an Expression Transformation to Decode the column taken into consideration. For more details on how the mapping is performed please visit Working with Normalizer
Q5. Suppose we have a source table and we want to load three target tables based on source rows such that first row moves to first target table, secord row in second target table, third row in third target table, fourth row again in first target table so on and so forth. Describe your approach.
Ans. We can clearly understand that we need a Router transformation to route or filter source data to the three target tables. Now the question is what will be the filter conditions. First of all we need an Expression Transformation where we have all the source table columns and along with that we have another i/o port say seq_num, which is gets sequence numbers for each source row from the port NextVal of a Sequence Generator start value 0 and increment by 1. Now the filter condition for the three router groups will be:
§  MOD(SEQ_NUM,3)=1 connected to 1st target table
§  MOD(SEQ_NUM,3)=2 connected to 2nd target table
§  MOD(SEQ_NUM,3)=0 connected to 3rd target table
Q8. Suppose in our Source Table we have data as given below:
Student Name
Subject Name
Marks
Sam
Maths
100
Tom
Maths
80
Sam
Physical Science
80
John
Maths
75
Sam
Life Science
70
John
Life Science
100
John
Physical Science
85
Tom
Life Science
100
Tom
Physical Science
85
We want to load our Target Table as:
Student Name
Maths
Life Science
Physical Science
Sam
100
70
80
John
75
100
85
Tom
80
100
85
Describe your approach.
Ans. Here our scenario is to convert many rows to one rows, and the transformation which will help us to achieve this is Aggregator.