V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ge2009
V2EX  ›  问与答

Oracle 一个奇怪问题:将 A 的数据库导出后导入到 B 库,然后同一条 SQL 语句在 A(老库)能有查到结果,而 B 库找不到任何记录。

  •  
  •   ge2009 · 2014-02-20 15:49:23 +08:00 · 2151 次点击
    这是一个创建于 3929 天前的主题,其中的信息可能已经有所发展或是发生改变。
    先贴出那条SQL语句:
    SELECT /*+ use_nl(s, r) index_desc(s study_study_dttm_idx) */
    s.study_key study_key,
    s.patient_id patient_id,
    s.patient_name patient_name,
    s.patient_sex patient_sex,
    TO_CHAR(s.patient_birth_dttm, 'yyyymmdd') birth_date,
    s.patient_age patient_age,
    s.study_instance_uid study_instance_uid,
    s.study_id study_id,
    TO_CHAR(s.study_dttm, 'yyyy-mm-dd') study_date,
    TO_CHAR(s.study_dttm, 'HH24MISS') study_time,
    s.access_no access_no,
    s.study_desc study_desc,
    s.refer_doctor refer_doctor,
    s.read_doctor read_doctor,
    s.attend_doctor attend_doctor,
    s.consult_doctor consult_doctor,
    s.perform_doctor perform_doctor,
    s.other_patient_id other_patient_id,
    s.other_patient_name other_patient_name,
    s.institution institution,
    s.department department,
    s.study_size study_size,
    NVL(s.series_count, 0) series_count,
    NVL(s.instance_count, 0) instance_count,
    s.modalities modality,
    s.bodyparts bodypart,
    s.source_aetitle source_aetitle,
    s.study_priority study_priority,
    s.study_comments userdef2,
    s.patient_location patient_location,
    s.patient_residency patient_residency,
    s.patient_weight patient_weight,
    s.patient_size patient_size,
    s.study_reason study_reason,
    s.request_doctor request_doctor,
    s.request_code request_code,
    s.request_name request_name,
    TO_CHAR(s.request_dttm, 'yyyy-mm-dd (HH24:MI:SS)') request_dttm,
    s.request_department request_department,
    s.request_stat request_stat,
    s.ed_stat ed_stat,
    s.special_needs special_needs,
    sp_user.get_user_name(s.verifier_key) verifier_name,
    TO_CHAR(s.verify_dttm, 'yyyy-mm-dd (HH24:MI:SS)') verify_dttm,
    TO_CHAR(s.admit_dttm, 'yyyy-mm-dd (HH24:MI:SS)') admit_dttm,
    TO_CHAR(s.scheduled_dttm, 'yyyy-mm-dd (HH24:MI:SS)') scheduled_dttm,
    TO_CHAR(s.register_dttm, 'yyyy-mm-dd (HH24:MI:SS)') register_dttm,
    s.operators operators,
    s.specialty specialty,
    sp_user.get_user_name(s.treader_key) treader_name,
    TO_CHAR(s.tread_dttm, 'yyyy-mm-dd (HH24:MI:SS)') tread_dttm,
    sp_study.get_storage_status(s.study_key) storage_status,
    s.study_stat study_stat,
    sp_study.get_user_comments(s.study_key, 1) userdef1,
    (SELECT dx_desc
    FROM reportdx
    WHERE report_key = r.report_key
    AND ROWNUM = 1) dx,
    (SELECT fx_desc
    FROM reportfx
    WHERE report_key = r.report_key
    AND ROWNUM = 1) fx,
    s.diagnosis diagnosis,
    TO_CHAR(r.create_dttm, 'yyyy-mm-dd (HH24:MI:SS)') report_create_dttm,
    TO_CHAR(r.dictate_dttm, 'yyyy-mm-dd (HH24:MI:SS)') report_dictate_dttm,
    TO_CHAR(r.transcribe_dttm, 'yyyy-mm-dd (HH24:MI:SS)') report_transcribe_dttm,
    TO_CHAR(r.approval_dttm, 'yyyy-mm-dd (HH24:MI:SS)') report_approval_dttm,
    sp_user.get_user_name(r.transcriber_key) transcribe_name,
    sp_user.get_user_name(r.dictator_key) dictate_name,
    sp_user.get_user_name(r.reviser_key) reviser_name,
    sp_user.get_user_name(r.approver_key) approve_name,
    sp_user.get_user_name(r.creator_key) creator_name,
    sp_report.find(s.study_key) report_key,
    ROWNUM
    FROM study s, report r
    WHERE rownum <= 60
    AND s.study_key = r.study_key(+)
    AND series_count > 0
    AND instance_count > 0
    AND sts_stat != 'R'
    AND study_dttm <=
    TO_DATE('2014/02/19:09:25:45', 'YYYY/MM/DD:HH24:MI:SS')
    AND (study_dttm <
    TO_DATE('2014/02/19:09:25:45', 'YYYY/MM/DD:HH24:MI:SS') OR
    (study_dttm =
    TO_DATE('2014/02/19:09:25:45', 'YYYY/MM/DD:HH24:MI:SS') AND
    (NVL(s.patient_id, '') < '728264' OR
    (NVL(s.patient_id, '') = '728264' AND
    (s.study_key + 0) < 16685480))))
    AND study_dttm >=
    TO_DATE('2014/02/17:00:00:00', 'YYYY/MM/DD:HH24:MI:SS')
    AND study_dttm <=
    TO_DATE('2014/02/20:23:59:59', 'YYYY/MM/DD:HH24:MI:SS')


    对照过两个数据表结构好像是一样,好人求解!
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2331 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:11 · PVG 00:11 · LAX 08:11 · JFK 11:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.