日期:2014-05-17  浏览次数:20921 次

数据库连接问题; 奇怪了!!
SQL code

    insert into dmitem@itf_jst(
      consignor_code, item_code, item_name, barcode, opcode, formulation, supplier_city,
      item_bigsort, item_hitsort, inner_code, pack_no, package_number, bigpackage_number,
      big_weight, big_length, big_width, big_height, weight, length, width, height, 
      storage_conditions, consignor_item_name, specifications, supplier_code, approval_number,
      trademark, item_unit, item_cess, trade_price, retail_price, maintenance_cycle, 
      item_validity, state, isstimulant, specialsort, isbatchs, isimport, isregulation, isbirth,
      isexamine, istrack, isconsrelease, remark)
    select
      consignor_code, item_code, item_name, barcode, "OPCODE", formulation, supplier_city,
      item_bigsort, item_hitsort, inner_code, pack_no, package_number, bigpackage_number,
      big_weight, big_length, big_width, big_height, weight, length, width, height, 
      storage_conditions, consignor_item_name, specifications, supplier_code, approval_number,
      trademark, item_unit, item_cess, trade_price, retail_price, maintenance_cycle, 
      item_validity, state, isstimulant, specialsort, isbatchs, isimport, isregulation, isbirth,
      isexamine, istrack, isconsrelease, remark
    from 
      jst_view_article;



提示:此操作的 global_names 参数必须设置为 True
但是奇怪的是我把 "OPCODE" 改为 'opcode' 就可以顺利执行(这样就不能插入字段的值了)
对方数据库的 global_names 要求不能设为 True; 我该怎么办?

------解决方案--------------------
1、这里与global_names无关,global_names参数是用来设置DATABASE LINK的名称是否必须与被连接库的GLOBAL_NAME一致,对方数据库的global_names设为false的话你这边的数据库链路可以随便命名。
2、select "OPCODE" from jst_view_article;等同于 select opcode from jst_view_article;
但是,select 'opcode' from jst_view_article;得到是值全是'opcode'的记录。
不知道能不能解决你的问题?
------解决方案--------------------
你要想这张表dmitem@itf_jst中,给opcode字段,插入什么值?是‘opcode’?还是jst_view_article表中的OPCODE字段值?如果是后者,那么就别加双引号。如果是前者,相信你已经知道方法