sqlplus

How to View Oracle Stored Procedure using SQLPlus?

为君一笑 提交于 2019-11-26 20:36:03
问题 How can I view the code of a stored procedure using sqlplus for Oracle 10g? When I type in: desc daily_update; it shows me the parameter, but when I try to do the following: select * from all_source where name = 'daily_update'; I get no rows selected What am I doing wrong? 回答1: check your casing, the name is typically stored in upper case SELECT * FROM all_source WHERE name = 'DAILY_UPDATE' ORDER BY TYPE, LINE; 来源: https://stackoverflow.com/questions/7000224/how-to-view-oracle-stored

When or Why to use a “SET DEFINE OFF” in Oracle Database

廉价感情. 提交于 2019-11-26 20:23:32
问题 I'm watching a Script in Oracle and I see something I don't recognize REM INSERTING into database1."Users" SET DEFINE OFF; Insert into database1."Users" ("id","right") values ('1','R'); I'm looking for documentation about "set define off" and it's literally writing "disable the parsing of commands to replace substitution variable with their values" I don't really understand what they want to say. Can anyone help me? 回答1: By default, SQL Plus treats '&' as a special character that begins a

Maximum length of command line argument that can be passed to SQL*Plus?

六月ゝ 毕业季﹏ 提交于 2019-11-26 20:07:43
I am calling SQL*Plus from Linux C Shell: sqlplus username/password @file.sql var1 var2 var3 If I pass a string as var1 , how long can this string be? Is it governed by the OS? In this case: Linux version 2.6.9-100.ELsmp (mockbuild@x86-010.build.bos.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)) #1 SMP Tue Feb 1 12:17:32 EST 2011 Update: Empirical testing yielded the following results: A command line argument of 5200 characters gave the error, "Word too long." 1300 characters then produced the SQL*Plus error, "string beginning "(000796384..." is too long. maximum size is 239

How to insert a string which contains an “&”

天大地大妈咪最大 提交于 2019-11-26 19:27:53
问题 How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i. 回答1: I keep on forgetting this and coming back to it again! I think the best answer is a combination of the responses provided so far. Firstly, & is the variable prefix in sqlplus/sqldeveloper, hence the problem - when it appears, it is expected to be part of a variable name. SET

Oracle: Import CSV file

♀尐吖头ヾ 提交于 2019-11-26 18:55:20
I've been searching for a while now but can't seem to find answers so here goes... I've got a CSV file that I want to import into a table in Oracle (9i/10i). Later on I plan to use this table as a lookup for another use. This is actually a workaround I'm working on since the fact that querying using the IN clause with more that 1000 values is not possible. How is this done using SQLPLUS? Thanks for your time! :) Abi SQL Loader helps load csv files into tables: SQL*Loader If you want sqlplus only, then it gets a bit complicated. You need to locate your sqlloader script and csv file, then run

DBMS_OUTPUT.PUT_LINE not printing

限于喜欢 提交于 2019-11-26 17:18:14
When executing the following code, it just says the procedure is completed and doesn't print the infomation i want it to (firstName, lastName) and then the other values from the select query in a table below. CREATE OR REPLACE PROCEDURE PRINT_ACTOR_QUOTES (id_actor char) AS CURSOR quote_recs IS SELECT a.firstName,a.lastName, m.title, m.year, r.roleName ,q.quotechar from quote q, role r, rolequote rq, actor a, movie m where rq.quoteID = q.quoteID AND rq.roleID = r.roleID AND r.actorID = a.actorID AND r.movieID = m.movieID AND a.actorID = id_actor; BEGIN FOR row IN quote_recs LOOP DBMS_OUTPUT

Connect to sqlplus in a shell script and run SQL scripts

北战南征 提交于 2019-11-26 15:45:44
问题 I have a .sql file, which is a bunch of oracle pl/sql commands and I want to create a shell script to run these commands. Suppose that user/pass@server is my credentials. What will be the shell script to do such a task? 回答1: For example: sqlplus -s admin/password << EOF whenever sqlerror exit sql.sqlcode; set echo off set heading off @pl_script_1.sql @pl_script_2.sql exit; EOF 回答2: Wouldn't something akin to this be better, security-wise?: sqlplus -s /nolog << EOF CONNECT admin/password;

Webrick is very slow to respond. How to speed it up?

我怕爱的太早我们不能终老 提交于 2019-11-26 15:41:31
I have a Rails application that I'm running on my server. When I go to a remote desktop and attempt to load the application, the server takes a good 3-4 minutes to respond with a simple HTML page. However, when I load up the page locally on the server, the page shows up in just a second. I tried pinging the server from my remote desktop and the pings are going through successful in a reasonable amount of time. This all seems to have started after I installed Oracle's basic client and SQLPLUS. Should I suspect Oracle? Has anyone experienced anything similar to this? Having the same issue here

sqlplus statement from command line

狂风中的少年 提交于 2019-11-26 15:22:18
问题 Is it possible to do something like this? $ sqlplus -s user/pass "select 1 from dual" or $ echo "select 1 from dual" | sqlplus -s user/pass I know I can put select 1 from dual in a file and do this: $ sqlplus -s user/pass @myFile.sql but I'm wondering if it's actually necessary to create a file just to satisfy sqlplus 回答1: Just be aware that on Unix/Linux your username/password can be seen by anyone that can run "ps -ef" command if you place it directly on the command line . Could be a big

how to loop accepting user input with pl/sql?

岁酱吖の 提交于 2019-11-26 14:39:57
问题 I want to be able to insert a variable number of rows into a table based on user input? eg. Please enter value, enter "done" when no more values: value 1 Please enter value, enter "done" when no more values: value 2 Please enter value, enter "done" when no more values: done 2 Rows inserted successfully. I'm not sure how to store the rows temporarily and I'm not sure how to ask the user multiple times to insert data. Does pl/sql have arrays? Thanks 回答1: As others have said, PL/SQL alone is not