2

I am converting SQL Server stored procedures to Oracle. In SQL Server you can insert into a table from a function call.

Here is the SQL Server:

INSERT INTO t_tmpl( rel_class_code, rel_side, template_id, template_name, template_desc )
SELECT rel_class_code, ls_rel_side, obj_id, name, description
FROM etmf_get_templates_for_rel( ps_rel_class_code, ls_rel_side, pi_called_by )

The error message I get when converting this to Oracle is "PL/SQL: ORA-00933: SQL command not properly ended".

Does anyone know what this statement should look like in Oracle?

Thanks!!!

1
  • 1
    How is your function defined? Commented Nov 29, 2010 at 18:47

1 Answer 1

3

If your function returns a pipelined result set you just need to put the function inside TABLE as follows:

INSERT INTO t_tmpl
   (rel_class_code, rel_side, template_id, template_name, template_desc)
   SELECT rel_class_code, ls_rel_side, obj_id, name, description
   FROM TABLE(
      etmf_get_templates_for_rel(ps_rel_class_code, ls_rel_side, pi_called_by)
      )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.