CONCAT()

Description of concat.gif follows

Purpose:

  • CONCAT returns char1 concatenated with char2
  • The string returned is in the same character set as char1
  •  Oracle Database returns the datatype that results in a lossless conversion. Lossless, as the name suggests, means a conversion that does not result in loss of data.
  • if one of the arguments is a LOB, then the returned value is a LOB. LOB stands for Large Object. It’s a variable length data type for storing large objects. LOBs are a set of data types for storing large amounts of unstructured or semi-structured data.
  • If one of the arguments is a national datatype, then the returned value is a national datatype

DataTypes

  • CONCAT(CLOBNCLOB) returns NCLOB
  • CONCAT(NCLOBNCHAR) returns NCLOB
  • CONCAT(NCLOBCHAR) returns NCLOB
  • CONCAT(NCHARCLOB) returns NCLOB

--CONCAT() FUNCTION USED TO COMBINE STRINGS

SELECT CONCAT(‘Good morning,’, ‘ Mrs. Jones’) AS Result
FROM DUAL;

–Optionally, the double bars may be used as well
SELECT ‘Good morning,’ || ‘ Mrs. Jones’ AS Combined_names
FROM DUAL;

 

 

Implicit Conversion

This is the type of converison where the computer does the conversion to a specific character type.

Example,

— String Cancatenation
SELECT 1+3 || ‘ Mary had a little lamb.’AS SUM
FROM DUAL;

— Implicit conversion. The computer did the conversion
SELECT ‘2’ || 3.3 AS SUM
FROM DUAL;

https://docs.oracle.com/cd/B13789_01/server.101/b10759/functions022.htm

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top