I have the following table/view defined in Oracle 8.1.6:
CREATE TABLE HOUSE_ALLOWANCE (
UNIT_NO NUMBER(10, 0) NOT NULL,
DIST_ID VARCHAR2(5) NOT NULL,
HOUSE_ALLOWANCE_AMT NUMBER(10, 0) NOT NULL);
CREATE VIEW MAX_HOUSE_ALLOWANCE AS
SELECT UNIT_NO,
DIST_ID,
MAX(HOUSE_ALLOWANCE_AMT) AS HOUSE_ALLOWANCE_AMT
FROM HOUSE_ALLOWANCE
GROUP BY UNIT_NO, DIST_ID;
I drop a TOracleSession, TOracleDataSet, TDataSetProvider, and TClientDataSet onto a form and connect them all up. I put the following sql in the TOracleDataSet:
SELECT
Max_house_allowance.UNIT_NO,
Max_house_allowance.DIST_ID,
Max_house_allowance.HOUSE_ALLOWANCE_AMT
FROM MAX_HOUSE_ALLOWANCE Max_house_allowance
I set TOracleSession.Connected := True to connect to the database. When I set TClientDataSet.Active := True, I get an error message saying: "Invalid variant type conversion". If I set it to active a second time, it works as expected. It only happens when doing a MAX() or similar function. Is there a way to avoid opening the ClientDataSet twice?
CREATE TABLE HOUSE_ALLOWANCE (
UNIT_NO NUMBER(10, 0) NOT NULL,
DIST_ID VARCHAR2(5) NOT NULL,
HOUSE_ALLOWANCE_AMT NUMBER(10, 0) NOT NULL);
CREATE VIEW MAX_HOUSE_ALLOWANCE AS
SELECT UNIT_NO,
DIST_ID,
MAX(HOUSE_ALLOWANCE_AMT) AS HOUSE_ALLOWANCE_AMT
FROM HOUSE_ALLOWANCE
GROUP BY UNIT_NO, DIST_ID;
I drop a TOracleSession, TOracleDataSet, TDataSetProvider, and TClientDataSet onto a form and connect them all up. I put the following sql in the TOracleDataSet:
SELECT
Max_house_allowance.UNIT_NO,
Max_house_allowance.DIST_ID,
Max_house_allowance.HOUSE_ALLOWANCE_AMT
FROM MAX_HOUSE_ALLOWANCE Max_house_allowance
I set TOracleSession.Connected := True to connect to the database. When I set TClientDataSet.Active := True, I get an error message saying: "Invalid variant type conversion". If I set it to active a second time, it works as expected. It only happens when doing a MAX() or similar function. Is there a way to avoid opening the ClientDataSet twice?