Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Deleting some rows from a table.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Deleting some rows from a table.
 Login/Join
 
Silver Member
posted
Hi,

I am trying to delete rows from a table and am having a hard time finding a good way to do this. With this in mind, I do not want to delete all rows, only those rows that meet a certain criteria.

The table to be deleted from does not have any keys, so I cannot use the 'delete the existing record' option on the target properties.

I also tried using a DBMS SQL type flow and had
parsing errors occur after I entered the sql code to delete the rows.

Should I be using a stored procedure type flow to do this? And if so, does anyone have any samples for this?

Thanks in advance.

Regards,

Tom


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
 
Posts: 31 | Registered: June 01, 2009Report This Post
Expert
posted Hide Post
I would suggest using MODIFY with the NEXT statement.

This will step through the records, you will need to loop for each record to be deleted.

The only other option would be to TABLE the records out without the ones to be deleted, then clear the table and reload it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
You will probably need to create a stored procedure and use MODIFY/NEXT logic to delete the records. But you will want to run the stored procedure as part of a flow in order to get a log of the results. Your delete logic might look something like this:
MODIFY FILE <filename>
NEXT <column name>
ON NEXT IF <negative of your selection criteria for deleting> GOTO TOP ;
ON NEXT DELETE
ON NONEXT GOTO EXIT
DATA
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Silver Member
posted Hide Post
Hi Waz and Dan,

Thanks for the quick response.

Tom


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
 
Posts: 31 | Registered: June 01, 2009Report This Post
Member
posted Hide Post
Tom,

I would worry about performance with the check each record/looping approach. I think the phrase "when doing database things, use a database tool" is a good phrase to live by. I would go the DBMS SQL route. Your "parsing error" might have been just some bad SQL. Send your delete statement. Set based deleting from tables (and adding/modifying) is what DBs are made for.


------
Livin' down on the cube farm. Left, right, right.

iWay 5.6
Windows
Excel, Tab-delimited, XML
 
Posts: 23 | Location: Minnesota | Registered: July 27, 2009Report This Post
Silver Member
posted Hide Post
Forgot to update this posting. I used a stored procedure to call an sql statement that deleted
the rows from the table.


SQL DELETE FROM tableA where tableA_field >= &PARM1;
END


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
 
Posts: 31 | Registered: June 01, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Deleting some rows from a table.

Copyright © 1996-2020 Information Builders