Tuesday, January 10, 2012

Bleed the Freak


It's funny, but every time in my entire career that I've faced a you-can't-get-there-from-here when writing code, it's been resolved by listening to Alice in Chains.  Tonight's song: Bleed the Freak

I honestly have no idea what to think of that.

Oh, well.  At any rate, another life saved ;-)>.  Who knew that, when writing a db2 stored procedure,  Get Diagnostics ROW_COUNT could be confused by a variable assignment within the select statement.  Now I know.

Here's the code snippet in case anyone stumbles across this and needs it.  Hopefully it's clear.  v_vTable and SWV_RowCount were previously declared, as was v_last_block.:
--    The following is absolutely terrible, but GET DIAGNOSTICS ROW_COUNT simply would not work!!! 
--    It was returning 0 no matter what, perhaps confused by the INTO clause?

SET SWV_RowCount = (select count(N_OID_LST) FROM OID_MGMT WHERE C_OID_CL_ABR = v_vTable);
--      GET DIAGNOSTICS SWV_RowCount = ROW_COUNT;   
select N_OID_LST into v_last_block FROM OID_MGMT WHERE C_OID_CL_ABR = v_vTable;

No comments:

DBT-50000 when using DBCA.bat on Windows (Oracle 19.11)

I’ve been having some trouble getting DBCA to run in order to create databases. Thought I’d share it with you, and thus document it for la...