Posted on 2009-02-18
Last Modified: 2013-12-07
I have 2 questions for the PL/SQL experts here. I'm trying to loop thru a record of filenames that I add to along the way in my pl/sql procedure. I'm use to dealing with cursors that are based on table types and not just a plain record of information. So...1) how do I properly loop through a bunch of plain records? I'm use to "Fetch Into" for a loop...but this record type is not a cursor (see my code below) Do I have it correct?

 ....and my second question is 2) how do i compare two substring values to each other?  (see my code below). I'm getting an error back from the Oracle compiler saying that it was expecting a "=" when that is what I actually have. I'm a bit stumped.

code snippet...

  CURSOR bookpagekey_cursor IS

       SELECT e.record_id,




       FROM vsdm.editorial e, vsdm.doc_renditions d

       WHERE e.record_id=d.record_id;


    bookpagekey_record       bookpagekey_cursor%ROWTYPE;



    TYPE counted_assets IS RECORD

       (asset_filename    varchar2(64));


    counted_assets_record    counted_assets;



                   While proceed:='Y' LOOP

                      IF (SUBSTR(bookpagekey_record.file_name, 1, 7) = SUBSTR(counted_assets_record.asset_filename, 1, 7))

                      AND (bookpagekey_record.content_category LIKE '%Primary Image%')

                      THEN proceed:='N';

                      END IF;

                   END LOOP;   


-- I insert filenames into the RECORD further below (bottom) in the procedure (snippet below)

  IF ((bookpagekey_record.content_category LIKE '%Primary Image%') AND

                           (bookcode = SUBSTR(bookpagekey_record.book_page_key, 2, 2)))  


                          ((INSTR(bookpagekey_record.file_name, UPPER('_RC'), 1)=0)     AND 

                           (INSTR(bookpagekey_record.file_name, UPPER('_EDIT'), 1)=0)   AND

                           (SUBSTR(bookpagekey_record.file_name, -4, 1) <> '_')         AND

                           (SUBSTR(bookpagekey_record.file_name, -2, 1) <> '_')         AND

                           (INSTR(bookpagekey_record.file_name, UPPER('SPLIT'), 1)=0)   AND

                           (INSTR(bookpagekey_record.file_name, UPPER('COMBO'), 1)=0))


                       THEN PINewScanCount:=PINewScanCount+1;


                       END IF;

Open in new window

Question by:kencrest
    LVL 20

    Accepted Solution

    >>While proceed:='Y' LOOP

    This is where you're getting the "=" error , not in the substr. Change that to "=" instead of ":="

    Author Comment

    Nice Catch! Thx for spotting that. I have another PL/SQL question I'm posting. If you could answer it for me asap I'd appreciate it. Thx again!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Suggested Solutions

    Article by: Swadhin
    From the Oracle SQL Reference ( we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
    Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now