在ociuldr的SQL中使用绑定变量

    在以前的ociuldr中不能使用绑定变量, 现在作了一些改进, 允许传入最多20个绑定变量(我想也够用了吧), 所有的变量类型都被当作VARCHAR2类型. 这样的改进不知道是否有必要, 还不得而知.

SQL> select * from tab;

TNAME                          TABTYPE         CLUSTERID
------------------------------ -------------- ----------
AULEXT                         TABLE
A_SEQ_SYN                      SYNONYM
A_V                            VIEW
OBJD_LIST                      TABLE
T                              TABLE
TRANSACTION_CACHE_IOT_0        TABLE
T_HASH                         TABLE
T_LOB                          TABLE
T_LONG                         TABLE
T_LONGRAW                      TABLE
T_TRUNC2                       TABLE
T_TRUNC4                       TABLE

12 rows selected.

C:MYDUL>ociuldr user=anysql/anysql@test -
         query="select * from tab where tname like :P_NAME" -
         arg:p_name=T%

       0 rows exported at 2006-07-05 14:21:12
       8 rows exported at 2006-07-05 14:21:12

C:MYDUL>cat uldrdata.txt
T,TABLE,
TRANSACTION_CACHE_IOT_0,TABLE,
T_HASH,TABLE,
T_LOB,TABLE,
T_LONG,TABLE,
T_LONGRAW,TABLE,
T_TRUNC2,TABLE,
T_TRUNC4,TABLE,

    这样改是因为有一次要导出很多数据, 于是按某个字段划分范围重复执行. 我已将更新后的文件上传到本站, 需要用此功能的请重新下载.

留言 (4)

你好,你这个工具的确帮了我日常很多忙。
今天应用时发现些不明白的地方!
对于绑定变量,在命令行中运行正常,
但写成批处理好像不能统计,

ociuldr user=test/test@test query="select * from user_all_tables where table_name like :P_NAME" arg:p_name=Test%

如果写成
test.bat 内容:
@echo off
ociuldr user=sdzd/sdzd@DC_10.194.128.46 query="select * from user_all_tables where table_name like :P_NAME" arg:p_name=Test%

运行 test.bat
uldrdata.txt 内容为空。

屏幕显示
1550 bytes allocated for column TABLE_NAME (1)
1550 bytes allocated for column TABLESPACE_NAME (2)
1550 bytes allocated for column CLUSTER_NAME (3)
1550 bytes allocated for column IOT_NAME (4)
2050 bytes allocated for column PCT_FREE (5)
2050 bytes allocated for column PCT_USED (6)
2050 bytes allocated for column INI_TRANS (7)
2050 bytes allocated for column MAX_TRANS (8)
2050 bytes allocated for column INITIAL_EXTENT (9)
2050 bytes allocated for column NEXT_EXTENT (10)
2050 bytes allocated for column MIN_EXTENTS (11)
2050 bytes allocated for column MAX_EXTENTS (12)
2050 bytes allocated for column PCT_INCREASE (13)
2050 bytes allocated for column FREELISTS (14)
2050 bytes allocated for column FREELIST_GROUPS (15)
200 bytes allocated for column LOGGING (16)
100 bytes allocated for column BACKED_UP (17)
2050 bytes allocated for column NUM_ROWS (18)
2050 bytes allocated for column BLOCKS (19)
2050 bytes allocated for column EMPTY_BLOCKS (20)
2050 bytes allocated for column AVG_SPACE (21)
2050 bytes allocated for column CHAIN_CNT (22)
2050 bytes allocated for column AVG_ROW_LEN (23)
2050 bytes allocated for column AVG_SPACE_FREELIST_BLOCKS (24)
2050 bytes allocated for column NUM_FREELIST_BLOCKS (25)
1050 bytes allocated for column DEGREE (26)
1050 bytes allocated for column INSTANCES (27)
550 bytes allocated for column CACHE (28)
450 bytes allocated for column TABLE_LOCK (29)
2050 bytes allocated for column SAMPLE_SIZE (30)
1050 bytes allocated for column LAST_ANALYZED (31)
200 bytes allocated for column PARTITIONED (32)
650 bytes allocated for column IOT_TYPE (33)
850 bytes allocated for column OBJECT_ID_TYPE (34)
1550 bytes allocated for column TABLE_TYPE_OWNER (35)
1550 bytes allocated for column TABLE_TYPE (36)
100 bytes allocated for column TEMPORARY (37)
100 bytes allocated for column SECONDARY (38)
200 bytes allocated for column NESTED (39)
400 bytes allocated for column BUFFER_POOL (40)
450 bytes allocated for column ROW_MOVEMENT (41)
200 bytes allocated for column GLOBAL_STATS (42)
200 bytes allocated for column USER_STATS (43)
800 bytes allocated for column DURATION (44)
450 bytes allocated for column SKIP_CORRUPT (45)
200 bytes allocated for column MONITORING (46)
1550 bytes allocated for column CLUSTER_OWNER (47)
450 bytes allocated for column DEPENDENCIES (48)
450 bytes allocated for column COMPRESSION (49)

0 rows exported at 2007-12-04 23:07:22
output file uldrdata.txt closed at 0 rows.

请验证!谢谢

还有一个问题。
在批处理
@echo off
ociuldr user=test/test@test query="select * from user_all_tables where table_name like 'Test%'"

% 也不能正确运行。
请验证!谢谢

不好意思,突然想起,那是DOS的原因.
@echo off
ociuldr user=test/test@test query="select * from user_all_tables where table_name like 'Test%%'"

连写二个 %% 就可以!

遇到问题,先别急着问,多想想!

发表留言:

« Previous | Main | Next »

英语900句 | English 900

  • The late arrival of the ship had messed up all our plans.
  • 船到晚了, 把我们的计划全打乱了.
  • I had thought he knew the time of the meeting.
  • 我原以为他知道开会时间.
  • They had excepted me to go with them.
  • 他们原本希望我和他们一起去.
  • That was the third time that I had visited the place.
  • 那是我第三次参观那地方了.
  • After I had finished my paper, I put it in the drawer.
  • 我写完论文, 就把它放在抽屉了.