Eric
Eric

Reputation: 27

converting MYSQL code into oracle sql code

Below mentioned is the code in MYSQL. I was wondering if there is a way to convert the code into oracle. It would be really helpful if an explanation is given what is the meaning of this statement (countofzones AS CHAR charset utf8)

CAST(countofzones AS CHAR charset utf8) AS countofzones, 

Upvotes: 0

Views: 62

Answers (1)

Job Curtis
Job Curtis

Reputation: 175

In MySQL, CAST() converts data of one type to another type. In the example given, you are converting the column countofzones from whatever datatype it currently has to the CHAR type (with the utf8 characterset). The AS countofzones is simply an alias and is not relevant to the question. See MySQL documentation for further information.

The equivalent function in Oracle is named the same; CAST() and has very similar syntax.

CAST(countofzones AS CHAR(x))

where x is the maximum string length (see CHAR Datatype).

Upvotes: 1

Related Questions