oracle10g

How to include multiple commands in a JDBC SQL query to Oracle 10g?

别说谁变了你拦得住时间么 提交于 2019-12-08 08:34:47
问题 I'm completely new to Oracle (I come from MySQL and MSSQL) and am novice at JDBC. One of my table creation queries looks like this: CREATE TABLE "LISTS" ("ID" NUMBER NOT NULL ENABLE, "NAME" VARCHAR2(1000) NOT NULL ENABLE, "DOMAIN_ID" NUMBER NOT NULL ENABLE, CONSTRAINT "LISTS_PK" PRIMARY KEY ("ID") ENABLE ) / CREATE OR REPLACE TRIGGER "BI_LISTS" before insert on "LISTS" for each row begin select "LISTS_SEQ".nextval into :NEW.ID from dual; end; / ALTER TRIGGER "BI_LISTS" ENABLE / When I try to

Querying an Oracle Date field using a string in NHibernate HQL

北城以北 提交于 2019-12-08 08:07:57
问题 I'm trying to query a .NET DateTime property and compare it with a date string like so: SELECT cat FROM mydll.cats AS cat WHERE cat.BirthDay > '1999-02-20' When I'm trying to search by a date string (without the SetDate function) The query won't run saying I canno't compare a String to a Date . Is there a way or a certain format I can use to compare my date with a simple string (Maybe something like the ToDate function in Oracle SQL..) *I need to separate the HQL string from the NHibernate

How to select records grouped by the hour of the day including hours that have no records

六眼飞鱼酱① 提交于 2019-12-08 07:55:18
问题 I have a table in an Oracle database that contains actions performed by users in one of our systems. It's used for statistical analysis and I need to display the number of actions performed for a given date, grouped by hour of the day. I have a query that does that fine, however, it does not display the hours of the day that contain no actions (obviously because there are no records to display for that hour). For example, the query: SELECT TO_CHAR(event_date, 'HH24') AS during_hour, COUNT(*)

Union causing an ORA-01790: expression must have same datatype as corresponding expression

房东的猫 提交于 2019-12-08 07:45:18
问题 With the following query as an example: select p.product_id, p.product_name, product_type as product_type, from products group by p.product_id, p.product_name union select p.product_id, p.product_name, cast(collect(coalesce(product_type, decode(product_description,null,'DESCR' || '-' product_description) as my_type) as product_type, from products group by p.product_id, p.product_name The select statement in the first query returns product_type as a varchar and on the second query product_type

convert row into columns in oracle10g

喜夏-厌秋 提交于 2019-12-08 07:02:49
问题 how can i convert rows in to columns in oracle 10g( like pivot in oracle 11g),so that i can add multiple 'and' conditions for the primary key. ex: select emp_name from emp where empid = 1 and emp_age = 21; where empid = 12 and emp_age = 23; without using 'in' ,i have to get records which satisfies all the above condtions(Like 'and ' operation). 回答1: This blog entry on pivot queries may give you some ideas. 回答2: There is no easy way to do this in sql. If you know how many columns you need read

Apache Drill 1.2 and Oracle JDBC

半世苍凉 提交于 2019-12-08 06:11:39
问题 Using Apache Drill v1.2 and Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit in embedded mode. I'm curious if anyone has had any success connecting Apache Drill to an Oracle DB. I've updated the drill-override.conf with the following configurations (per documents): drill.exec: { cluster-id: "drillbits1", zk.connect: "localhost:2181", drill.exec.sys.store.provider.local.path = "/mypath" } and placed the ojdbc6.jar in \apache-drill-1.2.0\jars\3rdparty . I can successfully

generate database & tables schema (ddl) on Oracle pl-sql

折月煮酒 提交于 2019-12-08 06:01:59
问题 Anyone have a PL-SQL statement that i can use to generate database & tables schema for specific database on Oracle 10g? I need the schema in .sql file and if possible compatible with ANSI-92/99 sql implementation, so i can use the generated .sql directly on sql server 2005. Already heard about exp/imp, but it seems generated dump file, what i need just a simple ddl on .sql file. Thanks 回答1: I wrote oraddlscript which calls dbms_metadata.get_ddl (Pop's answer) for each database object owned by

Select max date, then max time

非 Y 不嫁゛ 提交于 2019-12-08 05:57:28
问题 I've table with currency rates: T_RATE_ID T_INPUTDATE T_INPUTTIME T_SINCEDATE 1 27.12.2012 22:41:01 28.12.2012 1 27.12.2012 23:45:21 28.12.2012 1 28.12.2012 21:23:11 29.12.2012 1 28.12.2012 21:40:01 29.12.2012 1 29.12.2012 22:33:49 30.12.2012 1 29.12.2012 23:47:19 30.12.2012 How to select max date and then max time for this date? Simple SELECT MAX(t_sincedate), MAX(t_inputdate), MAX(t_inputtime) returns max time in all records (23:47:19) I want get following results: 1 27.12.2012 23:45:21 28

Oracle (10g) equivalent of DATEADD(weekday, -3, GETDATE())

人盡茶涼 提交于 2019-12-08 05:12:55
问题 I'm looking for the Oracle (10g) equivalent of: DATEADD(weekday, -3, GETDATE()) from T-SQL (SQL Server) . This subtracts 3 weekdays from the current date. I'm not concerned about holidays or anything like that (and I can truncate the time part off myself). Just excluding weekends is fine. 回答1: It looks like you need to create a UDF. CREATE OR REPLACE FUNCTION business_date (start_date DATE, days2add NUMBER) RETURN DATE IS Counter NATURAL := 0; CurDate DATE := start_date; DayNum POSITIVE;

“ORA-00937: not a single-group group function” when running my query

梦想与她 提交于 2019-12-08 05:01:08
问题 i am using oracle 10g. my query is : select "Debtor"."DebtorName", sum(case when regionTable."Text" like '%North%' then to_number(count("Registration"."pkRegistrationId")) else 0 end) "North", sum(case when regionTable."Text" like '%South%' then to_number(count("Registration"."pkRegistrationId")) else 0 end) "South" from "Registration" inner join "CustomerRequisition" on "CustomerRequisition"."pkCustomerRequisitionId"="Registration"."fkCustomerRequisitionId" inner join "EnumerationValue"