I am trying to select some records from a table using an array into the variable init_av_days but its not working out. init_av_days is to be committed to another table after this select query. How best do you suggest i do this? Answer init_av_days is to be committed to another table after this select query Be…
Tag: oracle
How to aggregate with join
I am very new to SQL and I was wondering if someone could help me find the quantity on hand (dqty-sqty) for each iname? This is what I’ve been trying to do so far but the total quantity that I get is wrong: Thanks so much! Answer you need to take the sum of the delivered and sold items individually
How to output row count calculations in Oracle’s SQL*Plus
I am using SQL*Plus with Oracle 11.2 and I know how to output the count of rows adhering to some condition, e.g.: Also it is easy to output all rows in MY_TABLE: However, how can I output in SQL*Plus the ratio of the two counts, i.e. how can I do in SQL*Plus a calculation on the output from SQL commands?.
How to use different conditions depending on variable value. Pro C / SQL
I am quite new to pro c and wanted to know wether the below is possible. char car[11]; strcpy(car,””); /* default value*/ if this variable has a value it should be used within the sql below : So run …
DatabaseError: ORA-01555: snapshot too old
Data that I wanted to download was about 45,000,000 rows and 38 columns in Oracle 11g database. When I tried to download the data with chunksize=50000 in python, DatabaseError: ORA-01555: …
List of values as table
I’m looking for a smarter way to have a list of values as a table in Oracle. What I do nowadays is select ‘value1’ as val from dual union select ‘value2’ from dual What I’m hoping for is some …
Update row if exists or insert
I’m working on a web based PHP form that’s currently connect to an Oracle database. I’m trying to get the functionality working so that after a user submits the form it’ll check if a row exists based on the Job Number, if it does then update, otherwise insert the values. It’s bri…
SQL CASE Expression
I need to write a sql statement(Oracle) where I can withdraw data from two diff tables and check for a condition and return a certain string. My statement goes like this, When I run this I get a error: “FROM keyword not found where expected”and points to the c in line 2. and if I change the from t…
How to allow only numbers in (Oracle SQL)
I want to add a integrity constraint which only lets numeric data be added to the Unit_Price. Also, I have a email column in another table, how can I make it so a @ sign is required. Furthermore, if they dont enter email then it should be ‘ ‘unknow@gmail.con’ as default? Edit: Sorry the datatype was sup…
Oracle SQL closest date to given date
i have a table with a column for categories, date and price. Like this: So there are (almost) always two dates per group with two different prices. Now i need to write an SQL Statement to get the closest date per group to a given date(f.e. 05.05.2019). Group 1 has two dates an the SQL statement needs to Selec…