I have run this query: But it throws an error at column DATA_DEFAULT: ORA-00932: inconsistent datatypes: expected CHAR got LONG 00932. 00000 – “inconsistent datatypes: expected %s got %s” How can I fix that? Thanks! Answer You can’t do anything with a LONG. It’s a PITA that Oracl…
Tag: oracle
Select values based on DISTINCT combination of rest of columns Oracle DB
I want to select row IDs associated with distinct column combinations in the remainder of a table. For instance, if the distinct rows are I want to get the row IDs associated with each row. I can’t …
Oracle: Count non-null fields for each column in a table
I need a query to count the total number of non-null values for each column in a table. Since my table has hundreds of columns I’m looking for a solution that only requires me to input the table name. Perhaps using the result of: to get the column names and then a subquery to put counts against each col…
number formatting 9’999.00
I’d like to format a number in a SQL select like this How can I do this? It works for 9,999,999 with the following command Answer You are almost there. Just replace group separator (.) with a single quote (‘) and you are good to go. result:
Oracle SQL Unions error “query block has incorrect number of results columns”
I’m trying to write a query that pulls data from a lot of tables, and has about 20 unions. It’s pulling the same information repeatedly, but with more layers each time, to show a sort of tree. I want to compare the final two columns. I’m using a case to do this, and if I add a case to this
Converting an Oracle date (stored as a number) in a SQL OPENQUERY
I am trying to create a number of stored procedures in SQL accessing an Oracle database. All dates in Oracle are stored as a 10 digit number which is causing some confusion. I have designed some dynamic SQL which allows us to run an OPENQUERY to pick out parameters however what I want to be able to do is use
cx_Oracle: Error 933. ORA-00933: “SQL command not properly ended”: SQL command error?
Similar questions have been asked before but I’ve still been unable to identify a solution for this. My code: try: connection = cx_Oracle.connect(ORACLE_CONNECT) logger.info(“…
SQL select min() using SQL join
I need result like this (in Oracle SQL): Name Producer Min Price HDD 250 gb Western Digital 6000 HDD 500 gb Corsair 4000 HDD 750 gb Corsair …
“ORA-00907: missing right parenthesis” during inserting into table
insert into eas_citizen_text_info values(690102355714,’male’,’Shailendra’,’Baliram’,’Torane’,(‘1995-06-02′,’yyyy-mm-dd’),21,’Bauddha’,’Single’,’Building no-E9, Room no-23, Rajarshi Shahu Nagar,…
How to simplify nested select in where clause?
I have 4 tables EMPLOYEE, COMPANY, WORKS and MANAGES. The tables are defined as follows- I need to find all the employees who live in the same city as the company for which they work. So far I have done this. It’s working fine. But I want to know is there any simpler way to do this query? Answer You