Can anyone help me convert this code into Oracle SQL? Or please give me direction as to why this is throwing an error on Oracle SQL?
declare @PropertyName varchar(64)
set @PropertyName= 'ESRegion'
select PD.PropertyId,
PD.PropertyName,
convert(varchar(255), v.Value ) DisplayValue
from Property_Dictionary PD WITH(READUNCOMMITTED)
inner join CorpTax_LookupDefinition l on l.Lookupkey = pd.ReferenceType
join MDTable md on l.DataDictionaryTypeId = md.TableGUID
join ValueChar v on
(
v.TableID = md.TableID
and v.AttributeID = l.DisplayAttributeId
)
where PD.DataTypeid = 7
and PD.PropertyName = @PropertyName
This should work:
As mentioned elsewhere, this is a bit different. It will invoke a read lock on the table. If you care about that, then you need to research different Oracle options for locking. I changed CONVERT to CAST. It is not clear what the type of v.value is, but this should work. (For some types, to_char() would be better.)
I also put the variable directly into the query. If you want variables, then you are outside the score of just SQL, and into the realms of PL/SQL and TSQL.