I am a newb to Oracle. I used to use SQL Plus, and use set serveroutput on to see the results. However, when I started using Oracle Developer, my queries would run, however, I was not able to see the console or the results:
select *
from customer;
I assume that you mean "Oracle SQL Developer" application.
If yes, the in SQL Developer click on View option, then select Dbms output
DBMS Output window (panel) should appear somewhere on the screen.
Then, click on green plus sing in the DBMS-Output panel, and select a session you want to spy.
Related
Is there any shortcut for formatting the query in plsql developer?
I want to format below query:
SELECT * FROM T1, T2 WHERE T1.ID = T2.ID
like:
select
*
from
T1, T2
WHERE
T1.ID = T2.ID
I am using version 12.0.7.
For this version, function name is not Edit / PL/SQL Beautifier
It is Tools / Source / PL/SQL Beautifier
It took some time for me to find it. I hope this help others.
PL/SQL Developer does not have a default keyboard shortcut to launch the PL/SQL Beautifier but it is easy to configure one.
Open Tools --> Preferences, click on "Key Configuration", find the item "Edit / PL/SQL Beautifier", double-click on the empty space, click whatever keys you want to use for the shortcut, then click OK:
You can also enable the PL/SQL Beautifier to run automatically:
But be careful before you become too dependent on the code beautifier. They generally do not work well for Oracle SQL and PL/SQL. PL/SQL has a huge grammar and no code beautifier in existence can handle all types of code well. Also, dynamic code is much more important in PL/SQL than in other languages; beautifiers won't help with dynamic code so you'll likely need to manually format some code anyway.
You must select your query and then click PL/SQL Beautifier button.
For Ver. 12.07 you can click PL/SQL Beautifier button to format sql
Select your code and Use Ctrl-F7 on SQL Developer and PLSQL Developer as well.
If you want to customize PLSQL Beautifier, save your custom file on your PC and then import file and save it as picture below.
The PL/SQL Beautifier allows you to format your SQL and PL/SQL code through a user-defined set of rules. Your code can automatically be beautified when you compile, save, or open a file.
Chrome's Developer Tools have a handy prompt on the Resources page where I can execute SQL on my actual WebSQL database. But if the SQL is parameterised like this:
select * from SomeTable where ImportantField = ?
I get a message like this:
Number of '?'s in statement string does not match argument count
I know this is a SQLite message, but I don't see an obvious way to supply the arguments in Chrome Dev Tools. Is it possible?
You are not possibly trying to execute that SQL as-is on the prompt, are you ?
If yes, then obviously you are wrong.
why do you care about ? when you are executing your SQL on console, why not simply use the value.
select * from SomeTable where ImportantField = 'yourValue'
When using SSDT what I miss most is the ability to script the select statement of the top x rows like in SSMS.
Does anyone know if it's possible to turn that on somehow by an powertool or extension that enables the "Script As" functionality in SSDT?
You can right-click a database in the SQL Server Object Explorer (part of SSDT) and choose "New Query..." to get a query window. From there you can write and execute any query you like.
I've also got Redgate's SQL Prompt installed (I work for them), so typing "st100" gets me a top X query quickly -- the built-in intellisense may have something similar.
The same query ran in PL/SQL Developer shows time, however it does not show in Oracle SQL Developer. Is there a way to get the time in SQL Developer?
In SQL Developer:
In PL/SQL:
This is the details of the date field:
You can change this in the Tools / Preferences dialog of SQL developer:
Select Database / NLS Parameters in the tree view on the left.
Then put dd/mm/yyyy hh24:mi:ss into the Date Format field.
Press OK to close the dialog.
To make it simple:
use to_char() function, it will work with SQL developer as well as Pl/sql.
select to_char(sysdate,'MM-DD-YYYY HH:Mi:SS') from table_name;
Can't see your query, but in oracle, it would look like this:
select sysdate from dual
How can I view the results returned by a pipelined function in Oracle SQL Developer ?
I'm invoking the function using a simple select..from dual like
select piaa_extract.FN_PIAA_EXTRACT('01-JAN-00','01-JAN-12') FROM DUAL
and the result I get is
IQCFINAL.REC_PIAA(IQCFINAL.REC_PIAA,IQCFINAL.REC_PIAA,.....,IQCFINAL.REC_PIAA)
Allround Automations' PL/SQL developer displays the results beautifully in a tabular format, but I do not have a license for the full version of PL/SQL developer.
SQL*Plus' output isn't very good either, though better than Oracle SQL Developer's.
Any thoughts ?
Typically, you'd use
select * from table(piaa_extract.FN_PIAA_EXTRACT('01-JAN-00','01-JAN-12'))
Does that work?