I'm working with SAP Business One in a formatted search and have run into some syntax I am unfamiliar with or haven't come across before. This is probably pretty basic but can anybody shed some light on this please?
Ignore the $[system objects].
DECLARE @parent nVarChar(15)
SET @parent = (SELECT T0.FNum
FROM OACT T0
WHERE T0.ACode = $[DLN1.ACode])
@parent ='40099'
begin
if $[OCRD.ctry] = 'UK' and $[OCRD.zip] not like 'BBT_%%' begin select 19 end
else if $[ocrd.country] = 'SA' or $[ocrd.zipcode] like 'BBT_%%' begin select 31 end
else if $[ocrd.country] = 'NZ' begin select 41 end
else if $[ocrd.country] = 'AUS' begin select 51 end
else select 21
end
The full query currently doesn't work, but my question is, typically what does the "Select 21" or "Select 41" or "Select 51" or select xxx number return? Can anybody provide an example which will help me understand?
Thanks
Select [VALUE] will return just a value.
Oracle:
select 'Hello' from Dual
SQL Server:
Select 'Hello'
So what your code seems to be doing is setting/displaying a value, nothing more.
An example of another way you can use it, multiple items within a select:
http://sqlfiddle.com/#!2/a2581/28218/0
This works both in SQL Server and Oracle, no need for Dual.