sqlplus

UTL_FILE: Could not create a new file

谁说我不能喝 提交于 2019-12-11 15:55:33
问题 I'm using this statement in ly code to create/open à file: create it if does not exist yet/open it if already exists. w_file_handle := utl_file.fopen ('SAUV_DIR', 'sauv_tab_tbrcs_params.txt' , 'W') ; The file doesn't exist yet but it couldn't be created. I got this error: SQL> @MyScript.sql declare * ERROR at line 1: ORA-29283: invalid file operation ORA-06512: at "SYS.UTL_FILE", line 536 ORA-29283: invalid file operation ORA-06512: at line 14 Any ideas to create the file if doesn't exist yet

How can I get Time Zone Region from SQLPLUS?

十年热恋 提交于 2019-12-11 13:53:22
问题 I am using Oracle Developer and Oracle 11g (Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production) select SESSIONTIMEZONE from DUAL; Result in SQLPLUS/system_config_tbl_load.sql: -4:00 Result in SQL Developer: America/New_York gives different results in SQL Developer and SQLPLUS. I want to see the region in SQLPLUS. Additionally I have to do this for multiple locations and do not have the option of changing the Time Zone using "ALTER SESSION SET time_zone = 'America/New_York'

linux环境使用sqlplus执行SQL脚本中文乱码处理

巧了我就是萌 提交于 2019-12-11 13:36:16
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 某组服务器上的sqlplus在执行定时更新SQL脚本时,中文出现乱码。一开始找错了问题方向:从SQL更新脚本处理的源头开始,首先对windows下的编辑器生成的脚本文件做各种编码的尝试,然后又在vi编辑器里面进行字符编码(encoding)与文件编码(fileencoding)的各种调试。后来发现转了圈,不过并不算浪费时间,最起码对字符编码多了一些了解。 我是通过如下的方法解决sqlplus执行SQL脚本出现的中文乱码问题: 1.生产环境中的字符集全是UTF8,所以对于上传至服务器上的脚本都以'UTF8 without BOM'保存 2.查看Oracle的字符集编码: SQL> select userenv('language') from dual; USERENV('LANGUAGE') ---------------------------------------------------- AMERICAN_AMERICA.AL32UTF8 SQL> 3.修改Linux的NLS_LANG环境变量,修改Oracle指定的Linux用户下面“.base_profile”文件,加入如下: export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" 4.执行.bash_profile

Executable that runs a .sql file to prompt for a username to unlock in a oracle database. Needs to close at the end

自古美人都是妖i 提交于 2019-12-11 12:07:54
问题 I have an executable that connects to an Oracle database and runs a SQL script, stored in a ".sql" file. When the script runs, it prompts for a username input, and then unlocks it. After it completes the unlock and it pops up: User Altered with no errors And it goes back to the sqlplus arrow. I would want the window to close after the script has run. It works perfectly on the remote server, without the connection details in the exe file. For some reason when I add the connection details in my

Oracle Setting Up a Globalization Support Environment

╄→尐↘猪︶ㄣ 提交于 2019-12-11 10:43:20
问题 We want to set this SET NUMFORMAT 99999999999999999.00 at the user/schema level, for all sessions. Currently ,when set this command , it is getting applicable for that session only. Can we do this globally , so that when ever we open the connection , this works > 回答1: SET NUMFORMAT is a SQL*Plus command. In general, it is a client-side setting to display the number. You could always store the SQL*Plus settings in login.sql and glogin.sql . Whenever SQL*Plus starts up, it looks for a file

sqlldr - load completion not reflected

孤者浪人 提交于 2019-12-11 10:32:31
问题 I have a bash script ( load_data.sh ) that invokes the sqlldr command to load data from a .csv into a table ( data_import ). On a recent invocation, I noticed that even though the command execution was completed, the table didn't contain the data from the .csv file. I say this because the subsequent statement ( process_data.sh ) in the bash script tried to run a stored procedure that threw the error ORA-01403: no data found . I learned that the commit happens right after the file load. So, I

Oracle SQL*Plus ACCEPT Statements

有些话、适合烂在心里 提交于 2019-12-11 09:19:41
问题 I need a bit of help with my SQL*Plus script. Is there any way I could have it so that it will accept a variable, check the table for a match and if it finds it exit the program and not continue with the rest of the accept statements? I have this code so far: ACCEPT p_cname PROMPT 'Enter Customer Name: ' DECLARE v_cname CHAR(20); BEGIN SELECT cname INTO v_cname FROM customer WHERE cname = '&p_cname'; IF v_name = '&p_cname' THEN -- Exit the program END IF; END; / -- Other ACCEPT statements if

Unwanted new lines when spooling an sqlplus result to xml file

和自甴很熟 提交于 2019-12-11 09:04:23
问题 I'm trying to extract some data from my database into a XML file. To do so, in use a bash script that calls sqlplus command and spool the result into a new file. The problem happens once the result extracted. My xml file isn't valid anymore because there are some unwanted new lines added... Here is an example of what I want: <xml> <element>John</element> <element>some data</element> <element>a longer data line</element> </xml> And here is what I got: <xml> <element>John</element> <element

INSERT inside plsql procedure does not tell how many rows were inserted

点点圈 提交于 2019-12-11 08:41:56
问题 i am trying to insert some rows and update some rows inside a pl/sql loop. however all i get to see is the pl/sql procedure is successfully completed. i do get to see dbmbs_ouput statements but not the output status of insert and/or update queries. the serveroutput is set to on. how do i get to see the status of insert and update rows(namely how many rows were inserted and updated) 回答1: In Oracle, the rowcount is not output automatically like it is in SQL Server . You should do it explicitly:

How to configure Oracle 11g to launch sqlplus?

元气小坏坏 提交于 2019-12-11 08:22:15
问题 On a RedHat 6 server, a third party application requires to be root to run and needs access to sqlplus. I have a running database, I can run sqlplus as user 'oracle'. When logged in as user root, 'sqlplus usr/pwd@dbname' works as expected. The trouble is that this agent needs to run sqlplus with no parameters and it always returns ORA-12546: TNS:permission denied. I've read a dozen times that enabling root to launch Oracle is a security issue but I really have no other choice. Running Oracle