oracle 如何比较 PL/SQL 中的字符串?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6303022/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:20:13  来源:igfitidea点击:

How to compare string in PL/SQL?

oracleplsql

提问by Vivek

i just want to know that, there is any way through which i can Compare a column value with Some String value.Something like this...
suppose column name is SHIPMENT_EXPEDITE_HAWBthen can i have like this in plsql

我只是想知道,有什么方法可以将列值与某些字符串值进行比较。像这样的事情......
假设column name is SHIPMENT_EXPEDITE_HAWB我可以在 plsql 中拥有这样的

SHIPMENT_EXPEDITE_HAWB=='PD'

Thaanks in advance!!!

提前致谢!!!

回答by Ben J

You just need one equals, not two.

你只需要一个等于,而不是两个。

IF shipment_expedite_hawb = 'PD' THEN
    dbms_output.put_line('Same');
END IF;

回答by ckruse

Just use the comparison operator ?=,“ e.g. SHIPMENT_EXPEDITE_HAWB = 'PD'

只需使用比较运算符 ?=,” 例如 SHIPMENT_EXPEDITE_HAWB = 'PD'