Oracle

ORA-00904: “Good”: invalid identifier ORA-06512

雨燕双飞 提交于 2021-02-17 05:37:28
问题 1.getting invalid identifier error while updating row_val variable char value 'Good' into the table 2.while inserting number it's working fine but strings its getting errors 3. declare count_temp number; csv_data varchar2(1000); val varchar2(100); row_val varchar2(100); sqlcmd varchar2(3000); col_name varchar2(100); col_data varchar2(100); begin csv_data:='good,son,r,,happy'; col_data:='varchar2(100)'; select regexp_count(csv_data, ',') + 1 into count_temp from dual; dbms_output.put_line

ORA-00904: “Good”: invalid identifier ORA-06512

两盒软妹~` 提交于 2021-02-17 05:37:27
问题 1.getting invalid identifier error while updating row_val variable char value 'Good' into the table 2.while inserting number it's working fine but strings its getting errors 3. declare count_temp number; csv_data varchar2(1000); val varchar2(100); row_val varchar2(100); sqlcmd varchar2(3000); col_name varchar2(100); col_data varchar2(100); begin csv_data:='good,son,r,,happy'; col_data:='varchar2(100)'; select regexp_count(csv_data, ',') + 1 into count_temp from dual; dbms_output.put_line

Oracle [Procedure] - Sum function ignores WHERE clause

穿精又带淫゛_ 提交于 2021-02-17 05:32:06
问题 I have a problem with a ORACLE Procedure, it seems that SELECT SUM ignores my WHERE clause, and Sums up ALL of the columns instead of only those that i want to (deptno). However if i use one of this functions like this for example : select SUM(SAL) AS SALSUM FROM SCOTT.EMP WHERE SCOTT.EMP.DEPTNO = 10; It displays the proper SUM. What may be the problem? Thanks for help. CREATE OR REPLACE PROCEDURE PROCEDURE1(numerdept IN number, money OUT number) IS SALSUM NUMBER; COMMSUM NUMBER; WYJATEK

Row for each date from start date to end date

余生长醉 提交于 2021-02-17 05:18:25
问题 What I'm trying to do is take a record that looks like this: Start_DT End_DT ID 4/5/2013 4/9/2013 1 and change it to look like this: DT ID 4/5/2013 1 4/6/2013 1 4/7/2013 1 4/8/2013 1 4/9/2013 1 it can be done in Python but I am not sure if it is possible with SQL Oracle? I am having difficult time making this work. Any help would be appreciated. Thanks 回答1: connect by level is useful for these problems. suppose the first CTE named " table_DT " is your table name so you can use the select

JPA Entity class giving error with 2 @GeneratedValue fields

霸气de小男生 提交于 2021-02-17 05:11:12
问题 I have two columns which will use @GeneratedValues, but when I am putting them like this it is giving error; " Exception Description: Class [class Testing] has two @GeneratedValues: for fields [Testing.SEQ_NO] and [Testing.ID]. Only one is allowed. " @Table(name = "TABLE1") @Entity public class Testing{ @GeneratedValue(strategy=GenerationType.AUTO) @Id private Long id; @Column(name = "LINKAGE_ID") private int linkageId; @Column(name = "TRANSFER_ID") private int transferId; @Column(name =

How to count the rows which contains non zero values in sql

最后都变了- 提交于 2021-02-17 05:09:16
问题 SELECT round(COUNT(dmd_1wk),2) AS NBR_ITEMS_1WK FROM table; Field dmd_1wk has so many zeros in it. How do I Count the non zero values? 回答1: Methinks bluefeets answer is probably what you are really looking for, as it sounds like you just want to count non-zeros; but this will get you a count of zero and non-zero items if that's not the case: SELECT ROUND(SUM(CASE NVL(dmd_1wk, 0) = 0 THEN 1 ELSE 0 END), 2) AS "Zeros", ROUND(SUM(CASE NVL(dmd_1wk, 0) != 0 THEN 1 ELSE 0 END), 2) AS "NonZeros"

How do I generate all the dates of Sunday between 2 dates in oracle sql?

无人久伴 提交于 2021-02-17 03:37:17
问题 How do I generate all the dates of Sunday between 2 dates in oracle SQL? Example if I want all the Sundays between "01/10/2018" and "31/12/2018" the output will be: 07/10/2018 14/10/2018 21/10/2018 ... 30/12/2018 Also how do I generate all the dates between 2 dates? Example: from "01/12/2018" to "31/12/2018" Output will be: 01/12/2018 02/12/2018 03/12/2018 ... 31/12/2018 回答1: Here's how; the CTE ( dates ) creates a "calendar" of all dates starting from 2018-10-01 , for number of days between

Creating table via SQL Command Line, invalid identifier

橙三吉。 提交于 2021-02-17 03:31:18
问题 I'm currently learning SQL and I've installed oracle 11g express on my system. I'm trying to create a table however when I try to run the below command I get the following Error Message: ERROR at line 3: ORA-00904 : invalid identifier CREATE TABLE PROJECTS ( proID NUMBER(4) NOT NULL, Desc CHAR(20), sDate DATE, eDate DATE, Budget NUMBER(7,2), maxStaff NUMBER(2) ); Can anybody please tell me what I'm doing wrong? Thanks for all the replies, I ran this command succesfully: CREATE TABLE PROJECTS

Changes to database session context persists with pooled connection reuse

流过昼夜 提交于 2021-02-17 02:47:45
问题 In my application, I have a connection pool that I use to obtain connections to Oracle database. I need to execute statements that call stored procedures that might affect the database session context/variables so that these changes affect only the current use of the connection. When I close the connection and obtain another connection from the pool, I want it like a new connection/session at which the effect of the procedure doesn't exist. Unfortunately, this doesn't happen. So I obtain a

Oracle Database, SQL Update statement will not work (OLEDB)

别等时光非礼了梦想. 提交于 2021-02-17 02:46:10
问题 I set a numeric primary key, and an alphanumeric field that stores truck FINS, which is just a random mix of numbers and letters. I do not generate the fins, these fins will always be the same as it's the truck fleet identification number. Here is the code view: storeTruckSplit = truckSplit[1];//Stores truck FIN //Update truck value try { conn.Open(); OleDbCommand command; command = new OleDbCommand( "Update Trucks" + " SET Trucks.TruckInUse = ? WHERE TFIN = " + storeTruckSplit.ToString(),