开发者

Is it possible to join strings in PL/SQL procedure in my sql statement

开发者 https://www.devze.com 2023-01-20 14:38 出处:网络
As the title suggests, I would like to know if it is possible to join the string in a select statement within a PL/SQL procedure.

As the title suggests, I would like to know if it is possible to join the string in a select statement within a PL/SQL procedure.

For example, I have something like this

SELECT FCS.CATEGORY, 
       FCS.NUMBERS, 
       FCS.POINTS 
 WHERE FCS.OBJECT = 'T' 
   AND FCS.THIS_DB & 开发者_运维百科strSelectedDB & 

So, is it possible to do something like this?


Your example is a little confusing. You can concatenate multiple strings using the || operator. But you'd then you'd have to compare the concatenated string to something. You can compare columns to local variables directly, though, i.e.

SELECT fcs.category,
       fcs.numbers,
       fcs.points
  FROM some_table fcs
 WHERE fcs.object  = 'T'
   AND fcs.this_db = strSelectedDB

assuming that strSelectedDB is a local variable in your PL/SQL block.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号