Get started with AnySQL utility -- chapter 5

    In AnySQL, we could manipulate LONG/LONG RAW/BLOB/CLOB easily by uploading a client file to the database, however it's impossible in SQL*Plus:

    Create a table with LONG type column, as following:

ASQL> DESC T_LONG

NO# NAME             NULLABLE TYPE
--- ---------------- -------- ----
  1 COL1                      LONG

    Now I will insert a shell script file in to the table, you can insert or update this field by declare a CLOB (for LONG and CLOB columns) or BLOB (for LONG RAW and BLOB columns) type host variable, and define it a file name (including path) as variable value, then reference it (start with ":") in the SQL as following:

ASQL> VAR P_LONG CLOB
ASQL> define p_long=otop
ASQL> insert into t_long values (:p_long);

1 rows affected.

ASQL> commit;

    And we could directly query the long value type in AnySQL directly, maximumly 64KB will be displayed:

ASQL> select col1 from t_long;

COL1
------------------------------------------------------------
#!/bin/sh

if [ "A${ORACLE_HOME}A" = "AA" ]; then
   echo "ORACLE_HOME environment variable not setted."
   exit
fi

if [ "A${LD_LIBRARY_PATH}A" = "AA" ];then
   LD_LIBRARY_PATH=/lib:/usr/lib
fi

if [ -d ${ORACLE_HOME}/lib32 ]; then
   LD_LIBRARY_PATH=${ORACLE_HOME}/lib32:${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
else
   LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${ORACLE_HOME}/lib64:${LD_LIBRARY_PATH}
fi

export LD_LIBRARY_PATH

dcba.bin -1 "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"


1 rows returned.

    AnySQL (actually Oracle's JDBC) may not have good support for multiple bytes character in single byte character set database, such as US7ASCII, WE8ISO8859P1 etc, please verify the result before doing any update to production host.

Post a comment

SCode:
Mail(*, but will not be displayed):
Home: