Loading ...
Sorry, an error occurred while loading the content.

RE: [SQLQueriesNoCode] With Clause

Expand Messages
  • Arnie Rowland
    You cannot use dynamic SQL inside a common table expression (cte) as you are attempting. You might be able to make the entire CTE dynamic SQL -but I think
    Message 1 of 19 , Jan 22, 2010
    • 0 Attachment
      You cannot use dynamic SQL inside a common table expression (cte) as you are attempting.

      You 'might' be able to make the entire CTE dynamic SQL -but I think you would find that to be very cumbersome and perhaps ineffective for the task.


      Regards,

      Arnie Rowland, MVP (SQL Server)

      "You cannot do a kindness too soon because you never know how soon it will be too late."
      -Ralph Waldo Emerson



      -----Original Message-----
      From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Prasanna Dhakephalkar
      Sent: Friday, January 22, 2010 6:25 AM
      To: Arnie
      Subject: [SQLQueriesNoCode] With Clause

      Hi,

      we use varible query inside with clause ?
      Like

      WITH tim AS
      ( ' select abc from ' || Input_table_name || ' a where num > 5')
      select abc from tim;

      This is part of a strored procedure input_table_name is a varchar2 input value to the procedure.


      I have variable query that gets used 3 times as a sub query,
      I thought with clause can help me.

      As such it is not allowing me.

      Any help is welcome.

      Thanks and Regards,

      Prasanna.




      [Non-text portions of this message have been removed]



      ------------------------------------

      Yahoo! Groups Links







      __________ Information from ESET Smart Security, version of virus signature database 4797 (20100122) __________

      The message was checked by ESET Smart Security.

      http://www.eset.com



      __________ Information from ESET Smart Security, version of virus signature database 4797 (20100122) __________

      The message was checked by ESET Smart Security.

      http://www.eset.com



      Disclaimer - January 22, 2010
      This email and any files transmitted with it are confidential and intended solely for SQLQueriesNoCode@yahoogroups.com. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of Westwood Consulting, Inc. Warning: Although Westwood Consulting, Inc has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.
      This disclaimer was added by Policy Patrol: http://www.policypatrol.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.