Get started with AnySQL utility -- chapter 3

    Following are the objects list in the test schema:

ASQL> select * from tab;

TNAME                   TABTYPE CLUSTERID
----------------------- ------- ---------
A_V                     VIEW
T_HASH                  TABLE
T_LOB                   TABLE
T_LONG                  TABLE

11 rows returned.

    How to get the difinition SQL for a view, or source code of a procedure? Using the "SOURCE" command:

ASQL> source anysql.a_v

select "TNAME","TABTYPE","CLUSTERID" from tab

    Get a table recreation syntax (for reference only, still under testing ...) :

ASQL> source anysql.t_lob

CREATE TABLE ANYSQL.T_LOB
(
   FNAME VARCHAR2(20) ,
   FTEXT CLOB
)
TABLESPACE USERS INITRANS 1 PCTFREE 10
STORAGE ( FREELIST GROUPS 1 FREELISTS 1)
NOCACHE LOGGING
/

    Get the table and relative indexes' size:

ASQL> ora size t_hash

OWNER  SEGMENT_NAME SEGMENT_TYPE      SIZE_MB INIEXT MAXEXT
------ ------------ --------------- --------- ------ ------
ANYSQL T_HASH       TABLE PARTITION       0.5  16384
ANYSQL IDX_T_HASH   INDEX PARTITION 0.4296875  16384  40960

2 rows returned.

    Get the length of LONG/LONG RAW fields, in this example column named "COL1" is of LONG type, first output is the bytes, second is KB:

ASQL> LOBLEN SELECT COL1 FROM T_LONG;

63521,62

    More features will be introduced in later chapters.

Post a comment

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