#1 02 May 2007 14:00

wcollante
Member
Registered: 02 May 2007
Posts: 1

PL/SQL-Loops

I have a look up table or a list like this..(Could this be a look table?).

CLUSTER
cl     zip
LLK  32834
LLK  32835
LLK  32836
ORG 32837
ORG 32838

Ohter table CONSUMER with all records with zips and other info

I need to link by zip and give totals for every distinct cl in the cluster table

PENETRATION
cl          total_addresses     total_mailables
LLK       56,320                  32,830
ORG      120,802                100,005



How would I have to this using iterative loops with pl/sql and build the PENETRATION table?

I appreciate your help on this

Offline

#2 12 Oct 2009 22:23

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 882
Website

Re: PL/SQL-Loops

I don't think you need any loop - thats just SQL

CREATE TABLE AS SELECT cl, sum(zip) from table_cluster group by cl;

On the syntax page for create table this is the last part (CREATE TABLE ..... [AS subquery])
http://ss64.com/ora/table_c.html

Offline

Board footer

Powered by FluxBB