oracle-sqldeveloper

Understanding the results of Execute Explain Plan in Oracle SQL Developer

前提是你 提交于 2019-11-27 05:02:01
问题 I'm trying to optimize a query but don't quite understand some of the information returned from Explain Plan . Can anyone tell me the significance of the OPTIONS and COST columns? In the OPTIONS column, I only see the word FULL. In the COST column, I can deduce that a lower cost means a faster query. But what exactly does the cost value represent and what is an acceptable threshold? 回答1: The output of EXPLAIN PLAN is a debug output from Oracle's query optimiser. The COST is the final output

Oracle TNS names not showing when adding new connection to SQL Developer

偶尔善良 提交于 2019-11-27 04:58:11
问题 I'm trying to connect to an oracle database with SQL Developer. I've installed the .Net oracle drivers and placed the tnsnames.ora file at C:\Oracle\product\11.1.0\client_1\Network\Admin I'm using the following format in tnsnames.ora: dev = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = idpdev2) ) ) In SQL Developer, when I try to create a new connection, no TNS-names show up as options. Is there something

How to extract week number in sql

扶醉桌前 提交于 2019-11-27 04:38:43
I have a transdate column of varchar2 type which has the following entrees 01/02/2012 01/03/2012 etc. I converted it in to date format in another column using to_date function. This is the format i got. 01-JAN-2012 03-APR-2012 When I'm trying to extract the weekno, i'm getting all null values. select to_char(to_date(TRANSDATE), 'w') as weekno from tablename. null null How to get weekno from date in the above format? Wolf After converting your varchar2 date to a true date datatype, then convert back to varchar2 with the desired mask: to_char(to_date('01/02/2012','MM/DD/YYYY'),'WW') If you want

Oracle SQL Developer: Show REFCURSOR Results in Grid?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 04:37:59
问题 As a follow-up to the question "Get resultset from oracle stored procedure", is there a way to show the results of a stored procedure that returns a REFCURSOR in a grid (instead of the plain text Script Output window) within SQL Developer? EDIT: The answer helped, but I'm still having a problem displaying the result set in the "View Value" window: The columns can only be expanded a small amount, probably due to the number of results being returned. Expanding the window with the resizer

How to generate an entity-relationship (ER) diagram using Oracle SQL Developer

我与影子孤独终老i 提交于 2019-11-27 02:28:45
I want to use Oracle SQL Developer to generate an ER diagram for my DB tables but I am new to Oracle and this tool. What is the process for creating an ER diagram in SQL Developer? Sergei Mardiyants Create a diagram for existing database schema or its subset as follows: Click File → Data Modeler → Import → Data Dictionary . Select a DB connection (add one if none). Click Next . Check one or more schema names. Click Next . Check one or more objects to import. Click Next . Click Finish . The ERD is displayed. Export the diagram as follows: Click File → Data Modeler → Print Diagram → To Image

Directly export a query to CSV using SQL Developer

元气小坏坏 提交于 2019-11-27 01:48:32
问题 Using SQL Developer to run queries works good, but I would save a lot of time if I instead of first running the query and then right click the result set and go through the export to csv routine. I was wondering whether it is a way in SQL Developer to: 1) Write the query, and then select that the result of the query should be exported to disk. 2) Write a queue of several queries, each of them writing their results to disk. 回答1: You can use the spool command (SQL*Plus documentation, but one of

How to export data with Oracle SQL Developer?

别来无恙 提交于 2019-11-27 01:12:36
问题 How to export Oracle DB data using SQL Developer? I need all data, tables, constraints, structure and so on. 回答1: In SQL Developer, from the top menu choose Tools > Data Export. This launches the Data Export wizard. It's pretty straightforward from there. There is a tutorial on the OTN site. Find it here. 回答2: In version 3 , they changed " export " to " unload ". It still functions more or less the same. 回答3: If, at some point, you only need to export a single result set, just right click "on

Spool Command: Do not output SQL statement to file

谁都会走 提交于 2019-11-26 22:46:24
I am wanting to output a Query to a CSV file and am using the below as a small test; spool c:\test.csv select /*csv*/ username, user_id, created from all_users; spool off; but the output has the actual select statment as the first line > select /*csv*/ username user_id created from all_users USERNAME USER_ID CREATED REPORT 52 11-Sep-13 WEBFOCUS 51 18-Sep-12 Is there a way to prevent this? I tried SET Heading Off thinking that might do it, but it did not change. I am using SQL Developer an running as script. Thanks Bruce Unfortunately SQL Developer doesn't fully honour the set echo off command

How to enter special characters like “&” in oracle database? [duplicate]

旧时模样 提交于 2019-11-26 22:41:02
问题 This question already has answers here : How do I ignore ampersands in a SQL script running from SQL Plus? (7 answers) Closed 2 years ago . I want to insert special character & in my insert statement. My insert is: INSERT INTO STUDENT(name, class_id) VALUES ('Samantha', 'Java_22 & Oracle_14'); If I try to run this query I am getting a popup and it asks me to enter value for Oracle_14 . How can I enter special characters like & in the insert statement for oracle db? 回答1: If you are in SQL*Plus

CHECK constraint on date of birth?

吃可爱长大的小学妹 提交于 2019-11-26 22:06:18
问题 I am creating my employee table in Oracle and for emp_date I would like to make it so the date of birth is not way back in the past and can not be set in the future? Is this too complex to implement in the CREATE TABLE statement? if so then I guess I have to skip it because that is the part where I have to create the constraints. , emp_dob DATE NOT NULL CREATE TABLE employee(emp_id NUMBER(4) PRIMARY KEY , emp_name VARCHAR2(40) NOT NULL , emp_address VARCHAR2(60) NOT NULL , emp_tel NUMBER(11)