sqlplus

Rename column named TYPE, LEVEL in sqlplus

我们两清 提交于 2019-12-25 04:51:13
问题 This needs to be done in sql plus. Hi, I'm struggling to rename two columns in my table. They are named "TYPE" and "LEVEL". This needs to be done in sql plus with no exception. The following does not work (works in sql developer tho): alter table client rename column level to clevel; alter table client rename column "level" to clevel; 回答1: LEVEL is an Oracle keyword , though not reserved. If you want to use it as an object name then you need to represent the name of an object with a quoted

Unreadable character in generated sqlplus file

时光毁灭记忆、已成空白 提交于 2019-12-25 02:59:37
问题 I have a shell with one command line opening sql plus and calling a sql file $ORACLE_HOME/bin/sqlplus id/psw @SQL_DIRECTORY/myfile.sql in this file I write this : spool myfile.csv select 'column 01', ';', 'column 02' from dual; select myColumn1, ';', mycolum2 from mytable spool off It works good BUT on the first line of the the first column of each select there is a special character. Why is that? how can I get rid of this Thanks 回答1: From the description it sounds like you have a login.sql

Unreadable character in generated sqlplus file

时光怂恿深爱的人放手 提交于 2019-12-25 02:59:16
问题 I have a shell with one command line opening sql plus and calling a sql file $ORACLE_HOME/bin/sqlplus id/psw @SQL_DIRECTORY/myfile.sql in this file I write this : spool myfile.csv select 'column 01', ';', 'column 02' from dual; select myColumn1, ';', mycolum2 from mytable spool off It works good BUT on the first line of the the first column of each select there is a special character. Why is that? how can I get rid of this Thanks 回答1: From the description it sounds like you have a login.sql

How can I show the column name in lower case?

烂漫一生 提交于 2019-12-25 00:35:47
问题 Table structure: SQL>DESCRIBE tipsdb; Name Null? Type ----------------------------------------- -------- ---------------------------- USERNAME CHAR(20) MAC CHAR(20) PASSWORD CHAR(50) SQL> Complete table output: SQL> select * from tipsdb; USERNAME ------------------------------------------------------------ MAC ------------------------------------------------------------ PASSWORD -------------------------------------------------------------------------------- arun aabbccddeeff whopee Current

Unable to run script despite escalating privilege in Ansible

天大地大妈咪最大 提交于 2019-12-25 00:12:37
问题 Im trying to run a shell script on the host machine after copying it over there using ansible. The script has 777 permissions. Please read the below question as it gives the full scope of the actual issue that we are trying to deal with Set different ORACLE_HOME and PATH environment variable using Ansible - name: Run the Script [List] shell: "/tmp/sqlscript/sql_select.sh {{item}} >> /tmp/sqlscript/output.out" become: yes become_method: sudo become_user: oracle register: orh with_items: "{{

Hiding plain text password with sqlplus command line

让人想犯罪 __ 提交于 2019-12-24 15:33:29
问题 I wish to use a sqlplus command with password hidden from view such that it doesn't show up on ps -ef command. I know there are a lot of solutions provided all over internet blogs but most of them seem to require admin privileges and I have restricted access on this server. And rest of them just don't seem to work me. The command that I am currently using is as below: sqlplus -s SOME_USERNAME/SOME_PASSWORD@somedns.intra.com:1500/SOMESID @some.sql Legend: SOME_USERNAME: schema/user SOME

.sql file not returning the column headers in csv file

孤者浪人 提交于 2019-12-24 13:02:51
问题 The below code is in batch file script(.bat file) which calls the sql file. del C:\SREE\csvfile.csv sqlplus SERVERNAME/Test123@ldptstb @C:\SREE\sree.sql set from_email="SENDER_EMAIL_ID" set to_email="TO_EMAIL_ID" set cc_email="CC_EMAIL_ID" set email_message="Csv file from application server" set body_email=C:\SREE\sree.txt set sendmail=C:\Interface\sqlldr\common\SENDMAIL.VBS set interface_log=C:\SREE\csvfile.csv cscript %sendmail% -F %from_email% -T %to_email% -C %cc_email% -S %email_message%

Properly Formatting Tables in SQLPLUS

北城以北 提交于 2019-12-24 10:26:35
问题 Before this gets voted as a duplicate question, I have spent quite some time on S.O. trying to fix this. As you can see in the screenshot below, my tables are looking messy. For the first and second table, you can see how there are 2 sets of column headings for each table. So how can I, for example, get all 5 customer records to be included in one table? The other thing I can't figure out is how to get the column headers to be properly formatted(not truncated and all on the same row). *I have

How to Execute an Oracle SQL Statements with VBScript

对着背影说爱祢 提交于 2019-12-24 06:38:05
问题 I am trying to execute an Oracle SQL statement or Oracle Functions through Microsoft VBScript and the loop throught the result set or display the value returned by the function So far I have managed to connect to Oracle via SQLPlus*, but now I am stuck. Can anybody help? Dim output Dim WshShell, oExec, input set WshShell = CreateObject("WScript.Shell") set oEnv=WshShell.Environment("Process") cmdString = "C:\Oracle\11g\product\11.1.0\ruby\BIN\sqlplus.exe -S stradmin/stradmin@ruby select *

When I enter a dateadd or datediff code i get this error all the time “ORA-00904 ”DATEADD“ INVALID IDENTIFIER.”

落花浮王杯 提交于 2019-12-24 03:24:15
问题 I have a university project and I have a patient table with admission and discharge date attributes. I need to delete records that are older than 7 years, I used the following code : delete from patient where dis_date >= datedadd(yy,-7,getdate()); I get the error "ORA-00904: "DATEADD" invalid identifier" . It's the same with the DATEDIFF function. Any alternatives please? 回答1: The typical way of doing this in Oracle would be: DELETE FROM patient WHERE dis_date < TRUNC(ADD_MONTHS(SYSDATE, -7