Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compare string in PL/SQL?

Tags:

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_HAWB then can i have like this in plsql

SHIPMENT_EXPEDITE_HAWB=='PD'

Thaanks in advance!!!

like image 954
Vivek Avatar asked Jun 10 '11 07:06

Vivek


People also ask

How do I match a string in PL SQL?

The LIKE operator compares a character, string, or CLOB value to a pattern and returns TRUE if the value matches the pattern and FALSE if it does not. If 'Zara Ali' like 'Z% A_i' returns a Boolean true, whereas, 'Nuha Ali' like 'Z% A_i' returns a Boolean false.

How do you check for equal in PL SQL?

In Oracle/PLSQL, you can use the = operator to test for equality in a query. For example: SELECT * FROM customers WHERE last_name = 'Anderson'; In this example, the SELECT statement above would return all rows from the customers table where the last_name is equal to Anderson.

Can we compare strings in SQL?

A string function is a function that takes a string value as an input regardless of the data type of the returned value. In SQL Server, there are many built-in string functions that can be used by developers. We can compare strings by using the IF-ELSE statement.


1 Answers

You just need one equals, not two.

IF shipment_expedite_hawb = 'PD' THEN
    dbms_output.put_line('Same');
END IF;
like image 179
Ben J Avatar answered Oct 02 '22 08:10

Ben J