Good day! I am trying to compile the procedure package in plsql developer, I swear at the subquery in the procedure, googling, I learned that such things are not supported by the developer. Unfortunately, my knowledge is not enough to find a solution that will replace this subquery, I can count on help with finding an option? The very line of code that swears

begin -- проверка, числится ли эталон в перечне неработоспособных if p_StandartId in (select n.standart_id from metrology.non_workable_standarts n) then 
  • we get a local variable. then make SELECT CASE p_StandartId in (select ...) THEN 1 ELSE 0 END INTO local_variable FROM dual; well and then already IF local_variable = 1 THEN - Okdel

3 answers 3

We get a variable, select the number of records that fit the condition. In the condition we use this amount.

 declare non_working number; begin select count(*) into non_working from metrology.non_workable_standarts where standart_id=p_StandartId; if non_working > 0 then ... end; 

    I had no experience with plsql, but I would venture to suggest that you can make an OUTER JOIN on the p_StandartId and standart_id fields and select those records where standart_id IS NULL .

       begin for rec in (select * from metrology.non_workable_standarts n where n.standart_id = p_StandartId ) loop --делаем здесь то что хотели делать по if then, пользуясь rec.имя поля end loop; end;