oracle-sqldeveloper

Printing the value of a variable in SQL Developer

∥☆過路亽.° 提交于 2019-12-11 04:35:39
问题 I wanted to print the value of a particular variable which is inside an anonymous block. I am using Oracle SQL Developer. I tried using dbms_output.put_line . But it is not working. The code which I am using is shown below. SET SERVEROUTPUT ON DECLARE CTABLE USER_OBJECTS.OBJECT_NAME%TYPE; CCOLUMN ALL_TAB_COLS.COLUMN_NAME%TYPE; V_ALL_COLS VARCHAR2(500); CURSOR CURSOR_TABLE IS SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE='TABLE' AND OBJECT_NAME LIKE 'tb_prm_%'; CURSOR CURSOR_COLUMNS

How to import data to a specified tablespace

烈酒焚心 提交于 2019-12-11 04:06:21
问题 My version of oracle is 11g. I had imported my oracle database to a SQL file called " export.sql ". Two days back I reinstalled my machine with windows and reinstalled Oracle also. Now I have created a user named "book" with password "book" and have given privileges using this command: grant create session, create table to book; Then I tried to import my SQL file using SQL Developer utility, by opening the export.sql file in the SQL editor. Then it showed me that SQL Error: ORA-01950: no

Can't connect to Oracle using tns

倾然丶 夕夏残阳落幕 提交于 2019-12-11 03:56:09
问题 I'm using an Oracle 11g R2 database. I use Oracle SQL Developer. If i create a new connection and check Basic Connection Type and fill the fields i can connect. If i select TNS and select the one i want in the dropdown menu, it says Failure E/S Exception: The Network Adapter could not establish the connection. This is the tnsnames.ora. I use it to connect to 2 database, dblilly and astrea. I can connect correctly to astrea. Listener is on and the instances ready. Do you see something i miss?

Oracle UTL_HTTP POST encoding multipart/form-data

丶灬走出姿态 提交于 2019-12-11 03:16:07
问题 I would like to do a POST from PL/SQL, using as enctype "Multipart/form-data" in order to post a document contained in a LONG RAW to a servlet. This would simulate a typical "FILE UPLOAD" as if done by a browser. I was wondering if there is any example on how to do it.. I think something like that could work .. but a working example would be very much appreciated document long raw; env VARCHAR2(32767); mytable record of varchar2(32767); http_req utl_http.req; BEGIN http_req:=utl_http.begin

SQL Developer OS authentication

允我心安 提交于 2019-12-11 03:07:18
问题 I have Oracle SQL Developer version 4.1.19 (64 bit) with JDK8 included. This is working for Oracle connections which require a {username, password} combination - no problem there. My issue is that I cannot connect with an OS Authentication configuration. Please note that I can connect from the command line with OS authentication by using sqlplus /@MY_TNS_NAME and this works fine. I have the SQL Developer application configured to use the OCI/Thick driver and also to use the x64 12.1.0.2.0

Error creating database link in Oracle

那年仲夏 提交于 2019-12-11 02:34:42
问题 I have two databases and need to write a cross database query. So I'm trying to create a database link. CREATE PUBLIC DATABASE LINK DBLink CONNECT TO SchemaName IDENTIFIED BY 123 using 'DBName'; When I executing this query it's take following error "ORA - 00933:SQL command not properly ended". Can anybody explain me where is the mistake? P.S. I'm using SQL Developer. 回答1: I actually solve this problem. The problem was in the numbers used as password. To fix it use double quotes in password

Oracle DB insert and do nothing on duplicate key

柔情痞子 提交于 2019-12-11 02:09:09
问题 I have to insert some data in oracle DB, without previously checking if it already exist. Does exist any way, transiction on oracle to catch the exception inside the query and handle it to don't return any exception? It would be perfect something in mysql's style like insert .... on duplicate key a=a 回答1: You can use MERGE. The syntax is a bit different from a regular insert though; MERGE INTO test USING ( SELECT 1 AS id, 'Test#1' AS value FROM DUAL -- your row to insert here ) t ON (test.id

SQL Developer Clears Bind Variable in Script

情到浓时终转凉″ 提交于 2019-12-11 02:07:43
问题 I am writing a script where the output from one procedure is needed for multiple later procedures. So, I need bind variables, not substitution variables. But, whenever the variable is used, it is cleared. That makes it impossible to use a variable's value more than once. The exact same script works in SQL*Plus. I have made a shortened script below that demonstrates the problem. Is this a setting that can be changed in SQL Developer? Is this a bug? In my case, I am using SQL Developer version

Majority function in SQL

一个人想着一个人 提交于 2019-12-11 00:39:51
问题 I am writing a SQL command to find majority of value(a value is returned as majority if its occurence in the table is more then 50%) in a table. For e.g. a Emp(name, age, dept) with values in table: (32, 33, 45, 45 ,45 21, 45) So if user wants to get majority value of field age, he will run the command: SELECT majority(age) FROM Emp Now at the backend the corresponding SQL command generated will be like: SELECT age FROM Emp GROUP BY age HAVING COUNT(*) > ((SELECT COUNT(*) FROM Emp) / 2); This

Oracle SQL: selecting from all_tab_columns does not find existing column

和自甴很熟 提交于 2019-12-10 17:17:34
问题 If I run the following query: select count(*) from all_tab_columns where column_name = 'foo' and table_name = 'VIEW0'; I get 0 for a result. I expect 1. But if I run the following query I get many (expected) rows returned: select foo from VIEW0; Why? I'm assuming I'm making some dumb syntax mistake or my understanding is way off. 回答1: Probably the reason is that you have case sensitive setting. Try to add UPPER function as below. select count(*) from all_tab_columns where column_name = upper(