I am using below dynamic query to fetch the data from a table. But while running I am getting the run time error "QUERY-PREPARE requires that SET-BUFFERS has been used to assign buffers to query . (7322)". Then I came to know that data is not available in the table. Can you help me how can we add validations to check the data availability before preparing the query? or how to stop this run time error?
define variable hbuffer as handle no-undo. define variable hQuery as handle no-undo. define variable cQuery as character no-undo. define temp-table tt_table no-undo field tt_data as CHARACTER . create buffer hbuffer for table "<table>". cQuery = "for each <table> no-lock where <table.fieldname> = 'test'". create query hQuery. hQuery:set-buffers(hbuffer). cQuery = cQuery + ":". if hQuery:query-prepare(cQuery) AND hQuery:query-open() then do: do while hQuery:get-next(): create tt_table. assign tt_data = hbuffer::<table.fieldname> . end. end.