I don't know that why I am unable to get these values inserted into the table.For below table: create table info  (serial_no number(10),  name varchar(10));  insert into info(serial_no,name) values(1,'g'),(2,'u');     /*For this query an error is coming*/  ERROR:  ORA-00933: SQL command not properly ended
10230
I'm looking for a good way to perform multi-row inserts into an Oracle 9 database.  The following works in MySQL but doesn't seem to be supported in Oracle.  INSERT INTO TMP_DIM_EXCH_RT  (EXCH_WH_KEY,   EXCH_NAT_KEY,   EXCH_DATE, EXCH_RATE,   FROM_CURCY_CD,   TO_CURCY_CD,   EXCH_EFF_DATE,   EXCH_EFF_END_DATE,   EXCH_LAST_UPDATED_DATE)  VALUES     (1, 1, '28-AUG-2008', 109.49, 'USD', 'JPY', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (2, 1, '28-AUG-2008', .54, 'USD', 'GBP', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (3, 1, '28-AUG-2008', 1.05, 'USD', 'CAD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (4, 1, '28-AUG-2008', .68, 'USD', 'EUR', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (5, 1, '28-AUG-2008', 1.16, 'USD', 'AUD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (6, 1, '28-AUG-2008', 7.81, 'USD', 'HKD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008');
6305
I'm not used to the 'as' keyword and I thought it would be a nice idea to use it. So why do I get an 'unknown column' (eid) error? I use mysql...  select t1.index as eid, t1.col1 as col1, t1.col2 as col2,  t2.index, t2.col1, t2.col2, t3.index, t3.col1, t3.col2  from table1 t1  left join table2 t2 on t2.index=eid left join table3 t3 on t3.index=eid;   The full statement is too long to present here without boring everybody.  The column and table names are random.
58738
I'm inserting multiple records into a table A from another table B. Is there a way to get the identity value of table A record and update table b record with out doing a cursor?  Create Table A (id int identity, Fname nvarchar(50), Lname nvarchar(50))  Create Table B (Fname nvarchar(50), Lname nvarchar(50), NewId int)  Insert into A(fname, lname) SELECT fname, lname FROM B   I'm using MS SQL Server 2005.
50568
Suppose I have a table with an auto_increment column, and then insert multiple values in a single statement:  insert into foo (bar) values ('a'), ('b'), ('c');  From the documentation, last_insert_id() returns the first generated ID for the query, the ID for a in this case.  Does mysql give any guarantees that a b and c will then be assigned sequential values?  In other words, if last_insert_id() returns 1 for a, is there any guarantee that b = 2 and c = 3? Or could there be a scenario where due to multiple concurrent inserts, I could end up with something like "a = 1, b = 5, c = 9"?
119372
I am very, very new to MYSQL.I tried to create a table named "option". My SQL Query is :  create table option(   id int not null primary key auto_increment,  choice varchar(30)  )  While executing this query it shows the following error  Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option( id int not null primary key auto_increment, choice varchar(30) )' at line 1 (0 ms taken)  If I try with the table name as "choice" it is working.  can we have the table name as "option" in mysql?   thanks
82651
I have an output of a query as follows:  bid  | code | amount        | ----------------------------- 2915 | BF   |   -10700.00   | 2915 | YQ   |   -300.00     | 2915 | YR   |   0.00        | 2915 | YM   |   0.00        | 2915 | WO   |   -153.00     | 2915 | IN   |   -329.00     | 2915 | K3   |   0.00        | 2915 | CUTE |   -50.00      | -----------------------------   I need to convert the values in code column to individual columns with column name as corresponding code and amount shall be the value.  bid  | BF       | YQ     | ... | CUTE  | ---------------------------------------- 2915 | -10700.00| -300.00| ... | -50.00|   The issue is that the result of my initial query has dynamic codes and hence need to generate columns accordingly.  Already tried the following logic but couldn't achieve the goal:   , ,   All the above links use some expression or the other to generate the columns.   My original resulting rows are result of simple select on multiple joined tables, and has no calculation or expression scope.  Kindly suggest some pointer or hint on how to achieve this.  Many thanks in advance.
6181
Something very odd is happening here.   I have a query that looks like this.  SELECT CAST(FT.DOP AS SMALLINT) FROM TRACKING_DATA WHERE date &gt; @mydate and identifier = 0000000000   When run as a raw query it returns data just fine.  When i place it in a stored procedure that alters the where clause it throws this error.  Msg 244, Level 16, State 2, Procedure myprocedure, Line 107 [Batch Start Line 2] The conversion of the varchar value '58629' overflowed an INT2 column. Use a larger integer column.   So here is the oddity. I go through all the possible data for that where clause with a query like this.  SELECT DISTINCT DOP FROM TRACKING_DATA where identifier = 000000000000   and  SELECT DISTINCT CAST(DOP AS smallint) FROM TRACKING_DATA where identifier = 000000000000   And this is what i get back.  17 12 9 19 8 14 6 16 11 13 7 10 0 18 5 15 4   Nowhere does it have anything remotely too large for a SMALLINT. So i thought, ok maybe its a non-printable ASCII character. But i can't find any.  I'm a little perplexed at the moment. It runs find as a raw query, explodes as a procedure and all possible data based on the where is valid. My only suspicion is that the query plan is doing something odd with filtering or maybe runs with different validation when run as a procedure.
36386
create table employee_tbl ( EmpID int primary key, FirstName varchar(50), LastName varchar(50), Salary float, MobileNo varchar(15) )  create table employeeaudit_tbl ( EmpID int primary key, AuditData varchar(50) )  select * from employee_tbl select * from employeeaudit_tbl  create trigger tr_employee_tbl_forinsert on employee_tbl for insert as begin         declare @EmpID int         select @EmpID = EmpID from inserted          insert into employeeaudit_tbl         values('New employee with EmpID = ' + CAST(@EmpID as nvarchar(5)) +'is added at ' + CAST(GETDATE() as nvarchar(50))) end
108573
I am getting below error while importing the dump,     ERROR 3105 (HY000) at line 82: The value specified for generated   column 'column_name' in table 'table_name' is not allowed.   When I describe the table with error, there are some generated columns in it.     option_type         | varchar(45)  | YES  | MUL | NULL    | VIRTUAL   GENERATED   What is the correct command to use when taking mysql dump for the database contains generated column?  MySQL server source and destination version:     mysqld Ver 5.7.26 for Linux on x86_64 (MySQL Community Server (GPL))   MariaDB mysqldump CLI version:     mysqldump Ver 10.17 Distrib 10.3.12-MariaDB, for Linux (x86_64)
43577
When I run the following in an Oracle shell it works fine  truncate table table_name   But when I try to put it in a stored procedure  CREATE OR REPLACE PROCEDURE test IS BEGIN     truncate table table_name; END test; /   it fails with  ERROR line 3, col 14, ending_line 3, ending_col 18, Found 'table', Expecting:  @   ROW  or   (   or   .   or   ;   :=   Why?
36370
This is probably a simple answer but I can't find it.  I have a table with a column of integers and I want to ensure that when a row is inserted that the value in this column is greater than zero.  I could do this on the code side but thought it would be best to enforce it on the table.  Thanks!  I was in error with my last comment all is good now.
81938
When I use varchar(5) in a INSERT query it means that the attribute in the table will take exactly 5 bytes in memory? (Given that one printable character takes one byte)?
28022
I know that it does consider ' ' as NULL, but that doesn't do much to tell me why this is the case.  As I understand the SQL specifications, ' ' is not the same as NULL -- one is a valid datum, and the other is indicating the absence of that same information.  Feel free to speculate, but please indicate if that's the case.  If there's anyone from Oracle who can comment on it, that'd be fantastic!
53877
I get the missing $ inserted error for the following code:  \begin{equation}  C = $ \frac{2}{\omega^2N^2\mu\pia} $  \end{equation}   I have tried out different changes based on Googling for this error, but nothing seems to help. Any suggestions would be appreciated.
87681
For some reasons, I would like to do an explicit quoting of a string value (becoming a part of constructed SQL query) instead of waiting for implicit quotation performed by cursor.execute method on contents of its second parameter.  By "implicit quotation" I mean:  value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" cursor.execute( query, (value,) ) # value will be correctly quoted   I would prefer something like that:  value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" % \     READY_TO_USE_QUOTING_FUNCTION(value) cursor.execute( query ) # value will be correctly quoted, too   Is such low level READY_TO_USE_QUOTING_FUNCTION expected by Python DB API specification (I couldn't find such functionality in  document). If not, maybe Psycopg2 provides such function? If not, maybe Django provides such function? I would prefer not to write such function myself...
80579
I have a table, call it TBL. It has two columns,call them A and B. Now in the query I require one column as A and other column should be a comma seprated list of all B's which are against A in TBL.  e.g. TBL is like this  1   Alpha  2   Beta  1   Gamma  1   Delta  Result of query should be   1   Alpha,Gamma,Delta  2   Beta  This type of thing is very easy to do with cursors in stored procedure. But I am not able to do it through MS Access, because apparently it does not support stored procedures.  Is there a way to run stored procedure in MS access? or is there a way through SQL to run this type of query
31406
I am planning to replace repeatedly executed Statement objects with PreparedStatement objects to improve performance. I am using arguments like the MySQL function now(), and string variables.   Most of the PreparedStatement queries I have seen contained constant values (like 10, and strings like "New York") as arguments used for the ? in the queries. How would I go about using functions like now(), and variables as arguments? Is it necessary to use the ?s in the queries instead of actual values? I am quite confounded.