Hi Wenjun,
Thank you so much for you response. I want to select based on a specific partition to make sure i have right data in my partition or for other reasons/verification. In Oracle we do SELECT COUNT(*) FROM table PARTITION (partitionname). Is there anything similar in HANA?
In an example scenario,
CREATE COLUMN TABLE TEST_TABLE
(
A INTEGER NOT NULL,
B INTEGER NOT NULL,
C VARCHAR(10) NULL,
PRIMARY KEY (A, B)
);
INSERT INTO TEST_TABLE(A, B, C) VALUES(1,1,'one');
INSERT INTO TEST_TABLE(A, B, C) VALUES(2,2,'1.00');
INSERT INTO TEST_TABLE(A, B, C) VALUES(3,3,'1');
Now i am trying to partition the non partitioned TEST_TABLE
ALTER TABLE TEST_TABLE PARTITION BY RANGE (B) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION OTHERS);
After partition i am doing a select in portion 3
SELECT * FROM TEST_TABLE WHERE TO_INTEGER(C) = 1 AND B = 3;
But the query fails with this response.
Could not execute 'SELECT * FROM TEST_TABLE WHERE TO_INTEGER(C) = 1 AND B = 3' in 1.053 seconds .
SAP DBTech JDBC: [339]: invalid number: [6930] Error during optimizer search
In theory, partition 3 has only one row whose C value('1') is convertible to integer. I'm not sure why this query fails. This is the reason i want to query partition 3 and verify if i have right data.
Thanks,
Suren.