Convert result from one column to 2 rows and more

Is it possible to take from one column the result and transfer it to two columns. By taking the first and second results as start and end and everyone else in the same way. i used pivot but didn’t get any real result. current result rn old_date_row 1 01-JUN-18 2 null 3 null 4 null… Read More Convert result from one column to 2 rows and more

PLS-00306: wrong number or types of arguments in call to a procedure

The SQL below results in the Oracle 11g error: PLS-00306: wrong number or types of arguments in call to ‘PRINT’. But it looks to me like my print procedure expects 1 varchar2 argument and that it’s exactly what I am passing to it as an argument. CREATE TABLE employees (full_name VARCHAR2(64)) // INSERT INTO employees… Read More PLS-00306: wrong number or types of arguments in call to a procedure

What percentage of clients live between 1 & 3 miles

Tried code: SELECT count(*) Count_people_inside_3miles FROM CLIENT_DATA WHERE (ABS(C_ADD_X) >=1 AND ABS(C_ADD_X) <=3) AND (ABS(C_ADD_Y) >=1 AND ABS(C_ADD_Y) <=3); SELECT count(CLIENT_ID) Count_Total_people FROM CLIENT_DATA; Result: COUNT_PEOPLE_INSIDE_3MILES 15 COUNT_TOTAL_PEOPLE 24 How do I calculate 15/24*100? >Solution : SELECT CONVERT(VARCHAR(5), (COUNT_PEOPLE_INSIDE_3MILES / COUNT_TOTAL_PEOPLE) * 100) + ‘%’ AS formatted_percentage FROM ( SELECT count(*) COUNT_PEOPLE_INSIDE_3MILES FROM CLIENT_DATA WHERE… Read More What percentage of clients live between 1 & 3 miles

How to visualize the result to show only 3 rows

I`m trying to show in my table only 3 rows and they need to contain from Calendar_month_number numbers 4,5,6 https://i.stack.imgur.com/SzYgY.png any suggestions select s.PROD_ID,t.DAY_NUMBER_IN_MONTH,t.CALENDAR_MONTH_NUMBER,sum(s.AMOUNT_SOLD) from CUSTOMERS c join SALES s on c.CUST_ID=s.CUST_ID join TIMES t on s.TIME_ID=t.TIME_ID where s.PROD_ID = 5 and t.TIME_ID BETWEEN ’01-APR-00’and ’01-JUL-00′ group by s.PROD_ID,t.DAY_NUMBER_IN_MONTH,t.CALENDAR_MONTH_NUMBER having sum(s.AMOUNT_SOLD) > 0; >Solution :… Read More How to visualize the result to show only 3 rows

Excluding symbols from strings

I have to filter one column (Product_Name) but I need to show only results which does not include symbols ‘_’ and ‘<‘ any ideas? SELECT p.PRODUCT_NAME,oi.QUANTITY as "TOTAL_QUANTITY",o.ORDER_MODE from PRODUCT_INFORMATION p join ORDER_ITEMS oi on p.PRODUCT_ID = oi.PRODUCT_ID join ORDERS o on oi.ORDER_ID = o.ORDER_ID where p.PRODUCT_NAME NOT IN (‘<‘,'(_)’) group by p.PRODUCT_NAME,o.ORDER_MODE,p.PRODUCT_ID,oi.PRODUCT_ID,oi.ORDER_ID,o.ORDER_ID,oi.QUANTITY having oi.QUANTITY… Read More Excluding symbols from strings

Why isn't SUBSTR stopping at the end index using instr?

I have a string value I’d like to make more presentable: ‘Course grade for <font color="#FF0000">Student Name</font>’ but my query to extract the Student Name: SELECT SUBSTR(col, instr(col, ‘>’,1,1)+1, instr(col, ‘<‘,1,2)) FROM my_table where course_id=1 returns Student Name</font> despite instr(‘<‘,1,2) returning the correct index. I’m not sure why it doesn’t stop on that index and… Read More Why isn't SUBSTR stopping at the end index using instr?