pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David B <postgresql@thegatelys.com>
To: pgsql-sql@postgresql.org
Subject: Syntax for cmd to EXEC...how many quotes?
Date: Tue, 20 Apr 2004 16:24:32 -0700
Message-ID: <GOEGKICPFOPNLIEIHGFJGEPBCKAA.postgresql@thegatelys.com> (raw)

Folks,

This is driving me crazy...I'm sure it's possible but that I am getting the
#quotes wrong in some way...
I keep getting unterminated string errors...now matter how many quotes I
use.

I have a FN that I want to loop through all views and populate a table with
a count(*) from each views.

To do it I'm doing a LOOP around all views...something like:

FOR r_rec IN SELECT viewname from pg_views
LOOP

    sql_string := 'INSERT INTO temp_table ( view_name, row_count ) SELECT
''' || r_rec.viewname || ''', count(*) FROM ' || r_rec.viewname  || ' ; ' ;

    EXEC sql_string ;

END LOOP ;

END ;


Building that sql_string is the problem.
Any thoughts folks?

-D
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004




view thread (3+ messages)  latest in thread

Message-ID: <GOEGKICPFOPNLIEIHGFJGEPBCKAA.postgresql@thegatelys.com>
Permalink:  ../GOEGKICPFOPNLIEIHGFJGEPBCKAA.postgresql@thegatelys.com/
Also on:    postgresql.org/message-id/GOEGKICPFOPNLIEIHGFJGEPBCKAA.postgresql@thegatelys.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: postgresql@thegatelys.com
  Subject: Re: Syntax for cmd to EXEC...how many quotes?
  In-Reply-To: <GOEGKICPFOPNLIEIHGFJGEPBCKAA.postgresql@thegatelys.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox