以下是我的观点:
CREATE OR REPLACE VIEW STUDENT_DETAILS AS
SELECT
COALESCE(Dept.deptname, stu.deptname,' ') AS deptname,
CASE WHEN college.JOIN_DATE IS NULL THEN ' ' ELSE TO_DATE(college.JOIN_DATE, 'dd-MM-yyyy') || ' ' END AS JOINDATE
FROM
College_register college
LEFT JOIN Department dept ON college.stuid=dept.stuid
LEFT JOIN student stu ON college.stuid=student.stuid;
当我执行以下查询时,我收到错误“ORA-01810:格式代码出现两次”
SELECT * FROM STUDENT_DETAILS;
但是当我执行如下(只是没有视图的选择查询)时,我不看到上述错误。
SELECT
COALESCE(Dept.deptname, stu.deptname,' ') AS deptname,
CASE WHEN college.JOIN_DATE IS NULL THEN ' ' ELSE TO_DATE(college.JOIN_DATE, 'dd-MM-yyyy') || ' ' END AS JOINDATE
FROM
College_register college
LEFT JOIN Department dept ON college.stuid=dept.stuid
LEFT JOIN student stu ON college.stuid=student.stuid;