我有一个Oracle开发需求似乎在逻辑上无法实现,我可以使用一些帮助来提供解决方案/解决方法。
总之,我需要检测传入列值(degree_code)是否已从供应商表中的现有列值更改。但是供应商表中的现有degree_code值是DE FACTO PRIMARY KEY的一个组件,因此如果传入的degree_code不同,则无法加入它。
假设: 供应商STUDENT_INFO表无法修改。 传入的数据无法提供OCCURRENCE_NUMBER。
相关表格:
一个。供应商STUDENT_INFO表:
no formal primary key, but a UNIQUE ROW can be found with 2 different
column combinations:
1. STUDENT_ID_NUMBER/OCCURRENCE_NUMBER:
Example: student1, occurence1: a bunch of degree-related data
student1, occurence2: a bunch of different degree-related
data
2. In addition a UNIQUE ROW is ALSO defined by the following DE FACTO
PRIMARY KEY:
STUDENT_ID_NUMBER
<<<DEGREE_CODE>>> (MA,BA, etc., anticipated or achieved)
DEGREE_YEAR (anticipated or achieved)
COLLEGE_ID (Harvard, Yale, etc.)
SCHOOL_CODE (School of Law, School of Business, etc.)
MAJOR_CODE (Business, Astronomy, etc)
START_DATE (date enrolled)
END_DATE (date degree completed)
B中。登台/工作表
formal primary key: STUDENT_ID_NUMBER/OCCURRENCE_NUMBER
degree-related columns with changed data values that are to be updated to
the vendor STUDENT_INFO table
接收,验证,处理和加载到学生学位相关数据的每日提要到Oracle临时/工作表 通过PL / SQL。
工作表中所需的OCCURRENCE_NUMBER在传入数据中不可用,必须使用DE FACTO PRIMARY KEY从供应商STUDENT_INFO表中检索以识别匹配的行。
当加载登台表时,它将加入STUDENT_INFO表,匹配STUDENT_ID_NUMBER / OCCURRENCE_NUMBER,然后将登台表的更改更新为STUDENT_INFO表。
除了招标辞职外,有人可以建议解决这个问题吗?
TIA
路
感谢所有回复的人。
场景是:student_id_number&#39; 1&#39;的度数代码发生变化。已发生的事情需要确定 然后从MA&#39; MA&#39;到MBA&#39;在STUDENT_INFO表中。
以下是有助于澄清的示例数据:
供应商STUDENT_INFO表:
row 1 row 2
------------- -------------
STUDENT_ID_NUMBER 1 1
OCCURRENCE 1 2
DEGREE_CODE BA MA
DEGREE_YEAR 2000 2000
COLLEGE_ID AA AA
SCHOOL_CODE BB BB
MAJOR_CODE CC CC
START_DATE 19990131 19990131
END_DATE 20010131 20010131
STAGE/WORK table:
row 1
-------------
STUDENT_ID_NUMBER 1 incoming data
OCCURRENCE 2 this needs to be retrieved from STUDENT_INFO table. STUDENT_ID_NUMBER/OCCURRENCE
is the key used in the vendor proprietary update process to update the STUDENT_INFO table
DEGREE_CODE MBA incoming data
DEGREE_YEAR 2000 incoming data
COLLEGE_ID AA incoming data
SCHOOL_CODE BB incoming data
MAJOR_CODE CC incoming data
START_DATE 19990131 incoming data
END_DATE 20010131 incoming data
如果需要进一步澄清,我很乐意帮助......
路