LONG
Example
Section titled “Example”CREATE TABLE Example ( ID NUMBER, LongColumn LONG);
INSERT INTO Example (ID, LongColumn) VALUES (1, 'Long text data type example.');
SELECT * FROM Example;Output
Section titled “Output”| ID | LongColumn || --- | ---------------------------- || 1 | Long text data type example |Explanation
Section titled “Explanation”In the above example, a table ‘Example’ is created with ID as NUMBER and LongColumn as LONG. It then inserts a row with the ID as 1, and LongColumn as ‘Long text data type example.’. Lastly, it fetches the data from the table. The returned result is the data where ID is 1, and LongColumn is ‘Long text data type example.’.
Example
Section titled “Example”DECLARE @LongExample AS VARCHAR(MAX);SET @LongExample = REPLICATE('A', 8001);SELECT LEN(@LongExample) AS 'LongStringLength';Output
Section titled “Output”LongStringLength----------------- 8001Explanation
Section titled “Explanation”This example illustrates the use of the data type VARCHAR(MAX), which allows for storage of variable-length non-Unicode character data up to 2 gigabytes of text data. It declares a variable @LongExample as VARCHAR(MAX) and sets it to a string of 8001 characters long. The SELECT statement is then used to return the length of the string, which is 8001.