ORA-12560: TNS:protocol adaptor error

o to the windows machine that hosts the Oracle database server Go to Start -> Run -> Services.msc in Windows. Locate OracleService < SID > (here OracleServiceORCL) and click on Start to start the oracle database service (if not already running) Once it is up and running, from the command prompt run the following:tnsping < tnsalias > (tnsalias entry you can … Read more

How can I return pivot table output in MySQL?

This basically is a pivot table. A nice tutorial on how to achieve this can be found here: http://www.artfulsoftware.com/infotree/qrytip.php?id=78 I advise reading this post and adapt this solution to your needs. Update After the link above is currently not available any longer I feel obliged to provide some additional information for all of you searching for mysql pivot … Read more

CREATE VIEW must be the only statement in the batch

Just as the error says, the CREATE VIEW statement needs to be the only statement in the query batch. You have two option in this scenario, depending on the functionality you want to achieve: Place the CREATE VIEW query at the beginningCREATE VIEW showing as select tradename, unitprice, GenericFlag from Medicine; with ExpAndCheapMedicine(MostMoney, MinMoney) as ( select max(unitprice), min(unitprice) … Read more

How to Select Top 100 rows in Oracle?

Assuming that create_time contains the time the order was created, and you want the 100 clients with the latest orders, you can: add the create_time in your innermost query order the results of your outer query by the create_time desc add an outermost query that filters the first 100 rows using ROWNUM Query: UPDATE for Oracle 12c … Read more