Professional Documents
Culture Documents
Home Forums Programmers EAI Distributed/Component Programming Mercator Software: Mercator solutions Forum
Hi,
Can i get the exact differences b/w DBQUERY & DBLOOKUP & LOOKUP & EXTRACT.
Thanks in Advance
DBLOOKUP
The DBLOOKUP function executes an SQL statement against a database. The SQL statement can be any permitted by your
database management system or ODBC driver.
Syntax
Note There are two different ways to specify the arguments for DBLOOKUP.
Meaning 1
Note The database query file (.mdq) is accessed at map build time and is not needed at runtime.
database_name - The third argument is the name of a database in the database query file (.mdq) as defined in the Database
Interface Designer.
If used in this way, both the .mdq file name and database name must be literals.
Meaning 2
path must be specified. The .mdq filename is followed by the keyword -DBNAME and the database name as specified in the
Database Interface Designer.
Note Using this syntax, the .mdq file is accessed at runtime and must be present.
OR
b) -DBTYPE database_type [database specific parameters]
The keyword -DBTYPE is followed by a keyword specifying the database type (for example, ODBC or ORACLE) followed,
optionally, by database-specific parameters.
Note This syntax does not use an .mdq file, because the database-specific parameters provide the information required to
connect to the database. Refer to the appropriate Database Adapter document for detailed information on the database-
specific parameters that can be specified.
All keywords (for example, -DBTYPE) can be upper or lower case, but not mixed.
A space is required between the keyword and its value (for example, -DBTYPE ODBC)
Returns
Example
Assume that you have a table named PARTS that contains the following data:
Also assume that this database has been defined using the Database Interface Designer in a file named mytest.mdq and that
the name of the database, as specified in the .mdq file, is PartsDB.
In this example using Syntax 2, both the .mdq file name and database name are specified.
Or, this way, using Syntax 2 by specifying the database type and the appropriate database-specific parameters:
DBLOOKUP("SELECT PART_NAME from PARTS where PART_NUMBER =1","-DBTYPE ORACLE -CONNECT MyDB -USER janes
")
For more examples using the DBLOOKUP function, see the Database Interface Designer Reference Guide.
Uses
Use DBLOOKUP to execute an SQL statement when you want to execute a SELECT statement to retrieve a specific column
value in a large table in a database using the value of another input, rather than defining the entire table as an input card and
using the LOOKUP, SEARCHDOWN or SEARCHUP functions.
Use DBLOOKUP to execute an SQL statement when you want to execute a SELECT statement to retrieve a specific column
value from a table or database that might vary based on a parameter file. Using Syntax 2 of the DBLOOKUP function would
allow these parameters to be specified dynamically at run time.
DBQUERY
http://www.tek-tips.com/viewthread.cfm?qid=1193508 2/6
12/4/2017 Difference b/w dlookup & dbquery ,lookup & extract - Mercator Software: Mercator solutions - Tek-Tips
The DBQUERY function executes an SQL statement against a database. The SQL statement can be any permitted by your
database management system or ODBC driver
Syntax
Note There are two different ways to specify the arguments for DBQUERY. See Meaning 1 and Meaning 2 below.
Meaning 1
Note The .mdq file is accessed at map build time and is not needed at runtime.
single-text-literal - The third argument is the name of a database in the database query file (.mdq) as defined in the Database
Interface Designer.
If used in this way, both the .mdq filename and database name must be literals.
Meaning 2
Note Using this syntax, the .mdq file is accessed at runtime and must be present.
OR
Note This syntax does not use an .mdq file, because the database-specific parameters provide the information required to
connect to the database. Refer to the appropriate Database Adapter document for detailed information on the database-
specific parameters that can be specified.
All keywords (e.g., -DBTYPE) can be upper or lower case, but not mixed.
A space is required between the keyword and its value (e.g., -DBTYPE ODBC)
http://www.tek-tips.com/viewthread.cfm?qid=1193508 3/6
12/4/2017 Difference b/w dlookup & dbquery ,lookup & extract - Mercator Software: Mercator solutions - Tek-Tips
Returns
If your SQL statement is a SELECT statement, this function returns the results of the query in the same format as a query
specified as a map input card, including row delimiters and terminators, etc.
If your SQL statement is anything other than a SELECT statement, this function returns NONE.
Examples
Assume that you have a table named PARTS that contains the following data:
Also assume that this database has been defined using the Database Interface Designer in a file named mytest.mdq and that
the name of the database, as specified in the .mdq file, is PartsDB
This example returns 1|" x 3" Bolt<cr><lf>2|" x 4" Bolt<cr><lf> where <cr><lf> is a carriage return followed by a line
feed.
Using Syntax 2, you can also specify the DBQUERY this way, where both the .mdq file name and database name is specified:
The following example, using Syntax 2, specifies the database type and the appropriate database-specific parameters:
DBQUERY ( "SELECT * from PARTS" , "-DBTYPE ORACLE -CONNECT MyDB -USER janes -PASSWORD secretpw" )
In another example, assume that you have an input file containing one order record. To map that order to another
proprietary format, you also have a parts table with pricing information for every part for every customer, a very large table.
Rather than using the entire parts table as the input to your map, you might use the RUN function with a DBQUERY to
dynamically select only those rows from the parts table corresponding to the customer in the order file, as follows:
RUN ( "MapOrder.MMC" ,"IE2" + DBQUERY ( "SELECT * FROM Parts WHERE CustID = " +CustomerNo:OrderRecord:OrderFile
+ " ORDER BY PartNo" , "PartsDB.MDQ", "PartsDatabase" ) )
Uses
Use DBQUERY to execute an SQL statement when you want to look up information in a database using a parameterized query
that is based on another value in your data.
If your SQL statement is a SELECT statement, the DBQUERY function may be used, in conjunction with the RUN function, to
issue dynamic SELECT statements whose results can be used as input to another map.
Use Syntax 2 of the DBQUERY function to execute an SQL statement when the database, table or other database parameters
might vary perhaps being supplied by a parameter file.
LOOKUP
The LOOKUP function sequentially searches a series, returning the first member of the series that meets a specified condition.
Syntax
Meaning
Returns
Examples
This example returns the Account# of Customer whose Company Name is ACME.
This example returns the Part# of DBSelect where the Model# in that row matches the ModelCode of Legacy and the Serial#
is greater than "123".
Uses
EXTRACT
The EXTRACT function returns each member of a series for which a specified condition is true.
Syntax
Meaning
Returns
Exampless
This example returns all POs, one at a time, whose Location is a particular Store#.
This example returns all Rows that have a ProcessFlag Column value of "Y".
Uses
Use EXTRACT whenever you need only particular members of a series returnedthose that meet a certain condition. An
example may be only POs that contain backordered items.
http://www.tek-tips.com/viewthread.cfm?qid=1193508 5/6
12/4/2017 Difference b/w dlookup & dbquery ,lookup & extract - Mercator Software: Mercator solutions - Tek-Tips
Note The EXTRACT function can only be used in a map rule. It cannot be used in a component rule.
Hi Janhes,
I really appreciate your help...but these information i can find in online library...but if you can able to xplain in your own
words that can be more helpful to me....sorry for troubling you......
If you were more concrete about your problem, help could be more specific.
Join | Advertise
http://www.tek-tips.com/viewthread.cfm?qid=1193508 6/6