Updated on 2026-11-06 GMT+08:00

URL_DECODE

Syntax

VARCHAR URL_DECODE(VARCHAR input)
VARCHAR URL_DECODE(VARCHAR input, VARCHAR encoding)

Description

The URL_DECODE function is used to convert an input string in application/x-www-form-urlencoded MIME format to a standard string.

Input Parameters

Parameter

Data Type

Description

input

VARCHAR

This parameter specifies the input string.

encoding

VARCHAR

This parameter is optional. It specifies the decoding format, which can be GBK or UTF-8. If this parameter is not specified, the default value UTF-8 is used.

Example

CREATE TABLE source (
  f_sequence INT
) WITH (
  'connector' = 'datagen',
  'rows-per-second' = '1'
);
CREATE TABLE print with(
'connector' = 'print'
) as select
  URL_DECODE ('http://calcite.apache.org') as value1,
  URL_DECODE ('https%3A%2F%2Fcalcite.apache.org') as value2,
  URL_DECODE ('http%3A%2F%2Ftest%3Fa%3Db%26c%3Dd') as value3,
  URL_DECODE ('http%3A%2F%2F%E4%BD%A0%E5%A5%BD') as value4,
  URL_DECODE ('test') as value5,
  URL_DECODE ('https%%3A%2F%2Fcalcite.apache.org') as value6,
  URL_DECODE ('https%3A%2F%2Fcalcite.apache.org%','UTF-8') as value7,
  URL_DECODE ('https%3A%2F%2Fcalcite.apache.org', 'gb2312') as value8
from source;
Table 1 Returned Result

value1(VARCHAR)

value2(VARCHAR)

value3(VARCHAR)

value4(VARCHAR)

value5(VARCHAR)

value6(VARCHAR)

value7(VARCHAR)

value8(VARCHAR)

http://calcite.apache.org

http://calcite.apache.org

http://test?a=b&c=d

http://Hello

test

null

null

https://calcite.apache.org