oracle11g

Oracle query is not working in C#

a 夏天 提交于 2020-01-15 07:15:28
问题 When I run this code it always returning zero while when i run this query in oracle sql client it returns 1. var strSQL = string.Format("SELECT COUNT(*) FROM GANTNER.GAT_REASONS WHERE CODE ='{0}'", StatusCode); objCmd = new OracleCommand(strSQL, objConn); objCmd.CommandType = CommandType.Text; int val = int.Parse(objCmd.ExecuteScalar().ToString()); For try I remove condition on column name CODE and it works but when I put column name CODE it does not then I tried to put "CODE" 'CODE' all not

Oracle query is not working in C#

余生颓废 提交于 2020-01-15 07:14:49
问题 When I run this code it always returning zero while when i run this query in oracle sql client it returns 1. var strSQL = string.Format("SELECT COUNT(*) FROM GANTNER.GAT_REASONS WHERE CODE ='{0}'", StatusCode); objCmd = new OracleCommand(strSQL, objConn); objCmd.CommandType = CommandType.Text; int val = int.Parse(objCmd.ExecuteScalar().ToString()); For try I remove condition on column name CODE and it works but when I put column name CODE it does not then I tried to put "CODE" 'CODE' all not

Split column into two columns based on type code in third column

落爺英雄遲暮 提交于 2020-01-14 17:27:52
问题 My SQL is very rusty. I'm trying to transform this table: +----+-----+--------------+-------+ | ID | SIN | CONTACT | TYPE | +----+-----+--------------+-------+ | 1 | 737 | b@bacon.com | email | | 2 | 760 | 250-555-0100 | phone | | 3 | 737 | 250-555-0101 | phone | | 4 | 800 | 250-555-0102 | phone | | 5 | 850 | l@lemon.com | email | +----+-----+--------------+-------+ Into this table: +----+-----+--------------+-------------+ | ID | SIN | PHONE | EMAIL | +----+-----+--------------+-------------

Oracle 11 g release 2 sample schema

女生的网名这么多〃 提交于 2020-01-14 15:59:08
问题 I installed Oracle 11g Release 2 on a windows 7 laptop and created a database using DBCA. In one screen there is an option to create sample schema but it was greyed out so I could not select it. I searched the dbhome\demo\schema\human_resources directory but there is only one file in it - hr_code.sql(It created triggers in hr schema). There is no sql to create hr schema or populate schema tables. I searched the net to download the scripts but no idea where to get them. Can you help me 回答1:

Why doesn't OJDBC 7 map the CHAR data type to a Java String?

这一生的挚爱 提交于 2020-01-14 09:11:49
问题 One of the jobs of OJDBC is to map Oracle data types to Java types. However, we noticed that if we give a CHAR data type, it is not mapped to java.lang.String . The versions showing this behavior are: OJDBC7 v12.1.0.2 and OJDBC6 v12.1.0.1 . The older versions did indeed map the CHAR data type to: java.lang.String . On digging deeper, we discovered that there is a class: StructMetaData within the oracle.jdbc.driver package of OJDBC that implements the Oracle data type to Java Type mapping.

Convert delimited string to rows in oracle [duplicate]

风流意气都作罢 提交于 2020-01-14 05:54:06
问题 This question already has answers here : How to convert comma separated values to rows in oracle? (4 answers) Closed 2 years ago . I used to use below query to convert comma delimited string to rows - select regexp_substr('A,B,C,D','[^,]+', 1, level) from dual connect by regexp_substr('A,B,C,D', '[^,]+', 1, level) is not null; But, now my delimiter is - '~^' I am not able to use same query for this delimiter. select regexp_substr('A~^B~^C~D^E','[^~^]+', 1, level) from dual connect by regexp

Run multiple sql statements using only execute in TOAD

早过忘川 提交于 2020-01-14 04:52:11
问题 I am trying to run multiple select SQL statements in TOAD using Execute command and not as execute as a script, Each statement ending with a semicolon but unfortunately TOAD is not allowing me to do this. Tried running as a single block by using begin and end but that attempt also failed. Is there any way to achive this.. 回答1: you can run it as a script in Toad: exec dbms_output.put_line('aaa'); exec dbms_output.put_line('bbb'); or use the following anonymous PL/SQL block and execute it as a

handling HTML data in Oracle query

纵饮孤独 提交于 2020-01-14 03:25:53
问题 I have a table with ID,TEXT,etc columns Here TEXT is clob column which contains data in HTML FORMAT SELECT ID,TEXT FROM TABLE WHERE ID=1000 I'm getting output for text column as below <p>NAME:  XXX<br />Company Name:  YYYYY<br />Location: ZZZ, 22 Z1Z1Z1, Z2Z2Z2,Z3Z3Z3, 0000024, IND<br />Type: PrePA<br /> Team: Team1, Dues tamble <br />Date: January 25 – 26, 2016<br />Rating:  Tr 2<br />Number: 8554342</p> <p><u>Observ: <br /></u>There were (6) major and (2) minor .<br /> <br />MAJOR</p><ul>

column values in a row

孤街浪徒 提交于 2020-01-14 03:14:10
问题 I have following table id count hour age range ------------------------------------- 0 5 10 61 10-200 1 6 20 61 10-200 2 7 15 61 10-200 5 9 5 61 201-300 7 10 25 61 201-300 0 5 10 62 10-20 1 6 20 62 10-20 2 7 15 62 10-20 5 9 5 62 21-30 1 8 6 62 21-30 7 10 25 62 21-30 10 15 30 62 31-40 I need to select distinct values of column range I tried following query Select distinct range as interval from table name where age = 62; its result is in a column as follows: interval ---------- 10-20 21-30 31

Select all from table Oracle

只愿长相守 提交于 2020-01-14 03:12:13
问题 I wrote a stored procedure to select all records from a table. Since I'm new to Oracle I have few questions. Is this Correct? Is this the best way to select all records from a table? How can I view result in SP in DB level? alter PROCEDURE employee_getall ( cv_results in out sys_refcursor ) IS BEGIN open cv_results for select * from employee_master EXCEPTION WHEN OTHERS THEN NULL ; END; 来源: https://stackoverflow.com/questions/30442927/select-all-from-table-oracle