oracle10g

Select Case, when no data return

余生长醉 提交于 2019-12-11 10:37:39
问题 it is possible do a SELECT CASE, decode, nvl or another query function when I need verify if the return of a select query is empty or has a value? For example, I have this: Record | type | id_customer -------+--------+------------- 1 | T | cus1 2 | A | cus2 3 | T | cus3 4 | | cus4 If I do this: select decode(type,'T','Main','A','Adicional','none') from table where record=1; I get Main. If I fo this: select decode(type,'T','Main','A','Adicional','none') from table where record=4; I get none.

Oracle sqlldr: column not allowed here

笑着哭i 提交于 2019-12-11 10:35:56
问题 Can anyone spot the error in this attempted data load? The '\\N' is because this is an import of an OUTFILE dump from mysql, which puts \N for NULL fields. The decode is to catch cases where the field might be an empty string, or might have \N. Using Oracle 10g on Linux. load data infile objects.txt discardfile objects.dsc truncate into table objects fields terminated by x'1F' optionally enclosed by '"' (ID INTEGER EXTERNAL NULLIF (ID='\\N'), TITLE CHAR(128) NULLIF (TITLE='\\N'), PRIORITY

error : ORA-01858: a non-numeric character was found where a numeric was expected

你离开我真会死。 提交于 2019-12-11 10:08:12
问题 When i execute my prepared statement i am getting the ORA-01858: a non-numeric character was found where a numeric was expected . When i searched through some forums, they say it is because of the date datatype. My prepared statement is insert into OPRS_ZONES( ZONE_ID, ZONE_CODE, ZONE_NAME, PLACE_ID, CORP_ID, CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE) values(?,?,?,?,?,?,?,?,?) The values i am trying to insert are 03.0, 'FLORIDA', 'FLORIDA', 05231.0, 01.0, 01.0, TO_DATE(

Named Parameters in SQL Queries - cx_Oracle - ORA-01460: unimplemented or unreasonable conversion requested

偶尔善良 提交于 2019-12-11 09:43:14
问题 I have encountered a problem after implementing the named parameters in RAW SQL Queries as per Python DB-API. Earlier, my code was as follows (and this works fine, both on my DEV Server and my Client's test server) cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) I changed it to the following cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) This changed version (with named parameters) works

Overlapping Data

北城余情 提交于 2019-12-11 09:34:00
问题 I have a sql query to check overlapping of product records in table PRODUCTS. In most cases query works fine except for the following. select * from products where product_reg_no = 'AL-NAPT' and (to_date('14-Aug-2001') BETWEEN to_date('27-Aug-2001') AND to_date('30-Aug-2001') or to_date('31-Aug-2001') BETWEEN to_date('27-Aug-2001') AND to_date('30-Aug-2001')) How to make this query to catch all records are overlapping either partially or completely? If required I can provide table structure

How to convert date(string type) into date(date time ) in oracle

此生再无相见时 提交于 2019-12-11 09:30:38
问题 I am stuck with a Oracle query. In my dashboard app, we have to show a summary graph for total of details lines basically. In one particular tab, we need the datetime in the details, but we group on the summary by date only. How to convert date(string type) into date(date time ) in oracle. I am using select within select in other words nested select. Inner query returns string date time, and outer query unable to convert this to date time 回答1: You would use the to_date function to convert a

java.lang.ArrayIndexOutOfBoundsException: for jdbc connection

懵懂的女人 提交于 2019-12-11 08:47:44
问题 I have no idea why I am getting this error, In the program i am not accessing any array. But its still giving this error. java.lang.ArrayIndexOutOfBoundsException: 0 at oracle.jdbc.driver.OracleSql.main(OracleSql.java:1666) I have posted the code below. public class ItT4 { public static void main(String[] args) { try { // loading the class Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (Exception e) { e.printStackTrace(); } }//closing main }//closing class I have set the class path

Get Account details in Oracle using function

本秂侑毒 提交于 2019-12-11 07:57:42
问题 we have two tables account and Dept where acocunt level 1 will be coming from acount table and level 2 and level 3 account level coming from dept. table Now based on the input we need to find the accountkey which is in both tables and it should display which accountkey based on source account id, db id and account level. Input: [112].[22].[1],[113].[23].[1],[245].[21].[2],[289].[20].[2],[301].[21].[3], [304].[20].[3] Description: 112 - Account id(level1 accountid or leve2 accountid or level3

How to write a query for a gaps and islands problem?

爱⌒轻易说出口 提交于 2019-12-11 07:56:43
问题 This is a gaps and islands problem. Meter_id |Realtimeclock |I_Y|I_B|I_X| 201010 |27-09-2018 00:00:00|1.0|2.0|3.0| 201010 |27-09-2018 00:30:00|1.0|2.0|3.0| 201010 |27-09-2018 01:00:00|1.0|2.0|3.0| 201010 |27-09-2018 01:30:00|1.0|2.0|3.0| 201010 |27-09-2018 02:00:00|1.0| 0 |3.0| 201010 |27-09-2018 02:30:00|1.0| 0 |0 | 201010 |27-09-2018 03:00:00|1.0|2.0|3.0| 201010 |27-09-2018 03:30:00|1.0|2.0|3.0| 201011 |27-09-2018 00:00:00|1.0|2.0|3.0| 201011 |27-09-2018 00:30:00|1.0|2.0|3.0| 201010 |28-09

ExecuteNonQuery always returns zero. Can i use this 0 value into my code for validation?

蹲街弑〆低调 提交于 2019-12-11 07:47:14
问题 I am creating a oracle user in dba_users table by using the below c# code where i am using oledbcommand and ExecuteNonQuery. User is being successfully created in the dba_users table but ExecuteNonQuery is always retun value as "0" So i am doing validation in my code as (IsUserCreated==0). Am i correct with my coding here? int IsUserCreated= oleCreateUserCommands.ExecuteNonQuery(); if(IsUserCreated==0) { //TBD code Response.write("User Created Successfully"); } else { //TBD Code Response