Troubleshooting - Getting Error [QODBC] Requires at least one child. Cannot delete last line
Problem Description:
I entered a series of purchase orders with queries that look like this:
INSERT INTO PurchaseOrderLine ("VendorRefListID", "RefNumber","PurchaseOrderLineItemRefListID", "PurchaseOrderLineDesc", "PurchaseOrderLineQuantity", "PurchaseOrderLineRate", "PurchaseOrderLineAmount", "FQSaveToCache") VALUES ('8000002F-1480957977', '1485', '800002C0-1480957977', '50-pc briquette set for hp 94751', 500, 8.00, 4000.00, 0);
I ran queries for c. 400 line items for 48 po's.
For whatever reason, this resulted in two distinct po's for each po number; that is, twice as many line items as I had intended.
I first thought to start over and try again. to that end, I ran this:
Delete FROM PurchaseOrderLine where TxnID='2770-1071519624'
This results in this error:
ERROR: [QODBC] Requires at least one child. Cannot delete last line.

So, I'm out of ideas.
Please tell me how to get rid of the duplicates.
Solution:
You cannot delete the last line. I think you have only one line item in a PurchaseOrderLine table for that particular TxnId. You cannot last line item which is associated with header row of PurchaseOrder.
You need to delete the header row from PurchaseOrder table, So please try to delete the row for that particular TxnID from PurchaseOrder table. Please verify the same & try again.
Please refer below sample query & check again.
For Example:
Delete FROM PurchaseOrder where TxnID='2770-1071519624'

|