Я пытаюсь найти исходное значение для строки, комбинируя студенческую историю и студенческую таблицу. Я должен создать динамический запрос c, который выбирает столбец во время выполнения из таблицы ученика с различными схемами. Когда я выполняю приведенный ниже запрос с более чем 90 столбцами, он выдает ошибку «ORA-01467»
select sh.id,
coalesce(sh.name,
lag(sh.name ignore nulls) over (partition by sh.id order by sh.DatetimeCreated),
s.name
) as name,
coalesce(sh.city,
lag(sh.city ignore nulls) over (partition by sh.id order by sh.DatetimeCreated),
s.city
) as city,
coalesce(sh.address,
lag(sh.address ignore nulls) over (partition by sh.id order by sh.DatetimeCreated),
s.address
) as address,
s.createdDateTime,
sh.createdDateTime as updatedDateTime,
Coalesce(sh.column1, lag(sh.column1)over(partition by sh.id order by sh.DatetimeCreated desc), s.column1) as column1,
from studenthistory sh join
student s
on s.id = sh.id
union all
select s.id, s.name, s.city, s.address, s.createdDateTime, s.updatedDateTime
from student s;