Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SOLVED: DB_EXPR VS SQL.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
SOLVED: DB_EXPR VS SQL.
 Login/Join
 
Platinum Member
posted
Hi,
Trying to find a difference between SQL. vs DB_EXPR
Seems like it finctions the same way. Is one prefered over the other.

I am planning to use it with a DEFINE.

Read in the documentation that:
DB_EXPR is used in a DEFINE with a WITH phrase.

Not sure how to use it WITH?

Looking for expert advise.

Thanks

This message has been edited. Last edited by: BM,


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Hi BM,

Check the documentation, there is an example of the use of DB_EXPR.

e.g.
DB_EXPR

As for the differences, you will need to check the SQL generated to compare, using SQL tracing

WITH is just a way to associate some info that is not in the table with a row in the table.

e.g.
Field/format WITH DBField = FUNCTION...


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
The SQL. is for direct reference of a sql function, where the DB_EXPR you can enter an full expression. That being said, you can reference a sql function using the DB_EXPR.

Example (MS SQL):
PASCALESUM/I11  WITH DMHR.ID_NUM=DB_EXPR(SUM(PAYSCALE) OVER(PARTITION BY PLANT));
START_DOW/A10  WITH DMHR.ID_NUM=DB_EXPR( DATENAME( dw,  START_DATE ) );
START_MONTH/I2=SQL.MONTH( START_DATE );   


The WITH is not always required with the SQL. prefix, but it doesn't hurt to add it.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Guru
posted Hide Post
Even when calling a function with SQL. it's limited. The parameters must be columns, constants or expressions.

If you want to call a function that takes a keyword then use DB_EXPR. For example the MS SQL Server function CONVERT takes a parameter of datatype such as CHAR:
DB_EXPR(CONVERT(CHAR, "start_date", 102))


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report This Post
Platinum Member
posted Hide Post
Thanks all


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
quote:
it's limited.

One of the most limiting is (or was) that only one pair of parenthesis can be used in SQL.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SOLVED: DB_EXPR VS SQL.

Copyright © 1996-2020 Information Builders