sqlplus

PLSQL, SQL*PLUS get current username?

别等时光非礼了梦想. 提交于 2019-12-22 05:04:13
问题 I know that the show user command return: USER is "SCOTT" But is it possible in a sql query or in a plsql script to only get the username of the current user and store it in a variable? 回答1: The USER built-in function may be used. DECLARE v VARCHAR2(30); BEGIN v := USER; END; 回答2: SYS_CONTEXT( 'USERENV', 'CURRENT_USER' ) 回答3: fnd_profile.value('USERNAME') fnd_profile.value('USER_ID') fnd_flobal.user_id these can be used to get the user details 来源: https://stackoverflow.com/questions/23417522

How to pass a variable from a Windows Batch File to SQL*Plus

北城以北 提交于 2019-12-21 21:35:07
问题 I want to pass a variable from a Windows Batch File to SQLPLUS, while displaying sql result batch variable should print along with the sql result. Result should be stored in csv file. How can I do that. This is possible in Unix(shell script) how can I do that in Windows(batch script). 回答1: I want to pass a variable from a Windows Batch File to SQLPLUS Just pass it as an argument to the SQL script. And use substitution variables in the same order that of the arguments list &1 &2... For example

EXECUTE recognizes a stored procedure, CALL does not

99封情书 提交于 2019-12-21 21:31:05
问题 When I try to run a stored procedure using EXECUTE, the proc runs fine. When I use CALL, I get "ORA-06576: not a valid function or procedure name" . I am connecting directly via toad. Why can't I use call? I have tried both of these Calls: CALL(BPMS_OWNER.DAILY_PARTITION_NOROTATE('MIP_TEST',5,5,'MIP_TEST_',5,FALSE,TRUE)); CALL BPMS_OWNER.DAILY_PARTITION_NOROTATE('MIP_TEST',5,5,'MIP_TEST_',5,FALSE,TRUE); The reason I need to use CALL is that our platform parses SQL before we send it to Oracle,

How to store result from SQLPlus to a shell variable

微笑、不失礼 提交于 2019-12-21 10:12:30
问题 My requirement is to store the result of an sqlplus operation into a variable in my shell script. I need the result of the following operation which is in my .sh file sqlplus 'user/pwd' @test.sql I have already tried testvar = 'sqlplus 'user/pwd' @test.sql' but that doesn't work. EDIT:: I changed it to testvar=sqlplus foo/bar@SCHM @test.sql and it says SQL*Plus:: not found [No such file or directory] I tried with testvar=$(sqlplus foo/bar@SCHM @test.sql) and it gives the same error. When I

How to store result from SQLPlus to a shell variable

不羁的心 提交于 2019-12-21 10:12:07
问题 My requirement is to store the result of an sqlplus operation into a variable in my shell script. I need the result of the following operation which is in my .sh file sqlplus 'user/pwd' @test.sql I have already tried testvar = 'sqlplus 'user/pwd' @test.sql' but that doesn't work. EDIT:: I changed it to testvar=sqlplus foo/bar@SCHM @test.sql and it says SQL*Plus:: not found [No such file or directory] I tried with testvar=$(sqlplus foo/bar@SCHM @test.sql) and it gives the same error. When I

Is it possible for Oracle sqlldr to accept a TNS entry as an instance qualifier in Oracle 10 and 11?

断了今生、忘了曾经 提交于 2019-12-21 03:58:18
问题 Is it possible to use a fully qualified TNS entry using sqlldr bundled with Oracle 10/11? For example, in SQLPlus: sqlplus user/password@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl))) @script.sql But using sqlldr (SQL Loader) there appear to be issues with using the TNS entry directly. Specifically: sqlldr user/password@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl))) bad='bad_file.txt' control='control.ctl'

Select into a temporary table in Oracle

∥☆過路亽.° 提交于 2019-12-21 03:39:19
问题 I am trying to do something like the following, select * into temp from (select * from student); It gives me the following error, ERROR at line 1: ORA-00905: missing keyword In my real example the subquery (select * from student) is more complex. I want to use this in a stored procedure, so I don't want to create the table itself. I just want to make my code more readable by using a temp table. 回答1: Then perhaps you need to do something like this: declare type t_temp_storage is table of

What username & password should be entered when connecting to SQL*Plus after installing Oracle 11g?

孤街醉人 提交于 2019-12-21 01:39:16
问题 I have installed Oracle 11g on Windows 7 When I start sqlplus, it ask me for a username and password Can anybody tell me what username needs to be inserted and when I try to type in any password, it doesn't allow me to type a single letter. Is there a reason why? 回答1: If you've forgotten the password for any user then you can reset by logging in as SYS: sqlplus / as sysdba And then: alter user <username> identified by <password>; If you've forgotten which users you have then you can run:

How to prettify the output coming from the SELECT query in command prompt?

吃可爱长大的小学妹 提交于 2019-12-21 01:05:06
问题 I ran the simple select query in the command prompt,but the output rows are not coming in a single line. See below: SQL> set pagesize 2000 SQL> select * from xtern_empl_rpt ; EMP LAST_NAME --- -------------------------------------------------- FIRST_NAME SSN -------------------------------------------------- --------- EMAIL_ADDR -------------------------------------------------------------------------------- YEARS_OF_SERVICE ---------------- 001 Hutt Jabba 896743856 jabba@thecompany.com 18

How do I get SQL*Plus to create views / tables with a blank line in the middle of the create statement?

对着背影说爱祢 提交于 2019-12-20 18:10:24
问题 I wish to create some views using SQL*Plus via script, but seem to hit a problem if a developer has placed a blank line mid statement. The following statement works fine in TOAD / PL/SQL developer etc, but fails in SQL*Plus. (This is usually scripted, but entering it manually gives exactly the same error) Can anyone tell me why / how to stop it? CREATE VIEW bob AS SELECT * FROM DUAL; With SQL*Plus output SQL> CREATE VIEW bob 2 AS 3 SELECT * 4 SQL> FROM DUAL; SP2-0042: unknown command "FROM