oracle10g

Moving ResultSet to first

本秂侑毒 提交于 2019-12-10 11:55:42
问题 I have a resultset obejct as rs and i used the fragment of code to count the number of rows.. while(rs.next()) count++; and i has to use the same resultset again to retrieve the data. I used the method rs.beforefirst(); but it is not working... control is not entering into while(rs.next()){ cid=rs.getInt(1); taskdate=rs.getString(2); tasktime=rs.getString(3); addr=rs.getString(4); } I has to return 4 rows according to my query.. but it doesn't ??? 回答1: Resultset is the forward only . If you

CHR(0) in REGEXP_LIKE

試著忘記壹切 提交于 2019-12-10 11:15:27
问题 I am using the queries to check how chr(0) behaves in regexp_like. CREATE TABLE t1(a char(10)); INSERT INTO t1 VALUES('0123456789'); SELECT CASE WHEN REGEXP_LIKE(a,CHR(0)) THEN 1 ELSE 0 END col, DUMP(a) FROM t1; The output I am getting like this - col dump(a) ----------- ----------------------------------- 1 Typ=96 Len=10: 48,49,50,51,52,53,54,55,56,57 I am totally confused, if there is no chr(0) as shown by the dump(a), how regexp_like is finding the chr(0) in the column and returning 1?

SQL Error: ORA-01401: inserted value too large for column

爷,独闯天下 提交于 2019-12-10 10:49:13
问题 I am getting issue while inserting a new record to the table in Oracle database. The error description says- SQL Error: ORA-01401: inserted value too large for column How would I come to know that which column is having large value as I am having 60 columns in the table. 回答1: SQL Error: ORA-01401: inserted value too large for column You are trying to insert value larger than the specified size for the column. How would I come to know that which column is having large value as I am having 60

ORA-00907 when dynamically creating a view in PL/SQL and using a CLOB

核能气质少年 提交于 2019-12-10 10:45:57
问题 This is one of those situations where you get an unhelpful error message back from Oracle. My situation is as follows: I'm dynamically creating a view in PL/SQL. I build a string and use EXECUTE IMMEDIATE to create the view. The string is so long that I use a CLOB to store it. When I run the code below in TOAD I get the unhelpful ORA-00907: missing right parenthesis error. Manually creating the view in TOAD (without the EXECUTE IMMEDIATE) gives no problems. My feeling is that the length of

Programmatically Change Expired Oracle DB Password?

扶醉桌前 提交于 2019-12-10 10:15:27
问题 Where I work, some databases get copied down from our production environment to our test environment, but the DBAs set all the passwords to expired on the (new) test DB right after the copy so that the production passwords are not known. So if I run sqlplus and connect to the test db with a specific username it immediately prompts me for a new password. Is there a way via a java app or shell scripting to automate the changing of an expired oracle 10g database password for a specific user? 回答1

Use regexp_instr to get the last number in a string

无人久伴 提交于 2019-12-10 04:29:01
问题 If I used the following expression, the result should be 1. regexp_instr('500 Oracle Parkway, Redwood Shores, CA','[[:digit:]]') Is there a way to make this look for the last number in the string? If I were to look for the last number in the above example, it should return 3. 回答1: If you were using 11g, you could use regexp_count to determine the number of times that a pattern exists in the string and feed that into the regexp_instr regexp_instr( str, '[[:digit:]]', 1, regexp_count( str, '[[

Oracle duplicate row N times where N is a column

眉间皱痕 提交于 2019-12-10 04:28:26
问题 I'm new to Oracle and I'm trying to do something a little unusual. Given this table and data I need to select each row, and duplicate ones where DupCount is greater than 1. create table TestTable ( Name VARCHAR(10), DupCount NUMBER ) INSERT INTO TestTable VALUES ('Jane', 1); INSERT INTO TestTable VALUES ('Mark', 2); INSERT INTO TestTable VALUES ('Steve', 1); INSERT INTO TestTable VALUES ('Jeff', 3); Desired Results: Name DupCount --------- ----------- Jane 1 Mark 2 Mark 2 Steve 1 Jeff 3 Jeff

Does Oracle's “date'[yyyy-mm-dd]'” literal always use the yyyy-mm-dd pattern?

霸气de小男生 提交于 2019-12-10 03:32:06
问题 Rephrased, given I use date like so: date'2010-04-10' , could the outcome be anything but April 10th 2010 (e.g. October 4th 2010)? UPDATE I hear what you, and the docs, say. But... When a batch job runs, with hard-coded date'yyyy-mm-dd':s, it fails for some (non-deterministic) calculations. Running the failing SQL statements in PL/SQL Developer never yields the same, incorrect, value. First, I ran the same calculations (hundreds of thousands) with the date'' date literals replaced with the to

Creating tables with fields from 2 different tables

这一生的挚爱 提交于 2019-12-09 23:35:50
问题 I want to create a table that stores values from two different tables; From table 1: cust_id (varchar2), invoice_amt (float) From table 2: cust_id (from table 1), payment_date My table should have 3 fields: cust_id, invoice_amt, payment_date I tried the following, which is obviously wrong. create table temp1 as ( select table_1.cust_id, table_1.invoice_amt, table_2.payment_date from table_1@dblink, table_2@dblink) Your valuable suggestions will be of great help. 回答1: create table temp1 as (

Oracle Database import .sql file by command prompt

别说谁变了你拦得住时间么 提交于 2019-12-09 15:39:42
问题 I want to import .sql file in Oracle by command prompt so please tell me that command to import .sql file in oracle in MYSQL I am using it like this mysql -u root -p -h localhost softpoint < D:\Nisarg\NEult\softpoint.sql but In Oracle I don't know how to use this utility so please help me Thanks 回答1: In Oracle, to run a script ( .sql) you use SQL PLUS command line utility. c:\> sqlplus user_name/user_password@connect_string @path\your_sql.sql 回答2: Try to use sqlplus : sqlplus user/password