trying to get used to sql * more running and creating a simple procedure
Hello all;I'm getting used to sql * more after using for a while using pl/sql developer.
I am trying to create a simple procedure and run it. See my procedure below
create or replace procedure test(t in varchar2(200), limit in number(30))
begin
select tbl_report.id from tbl_report where tbl_report.id like '|| t ||%' and rownum <= limit;
end test;
and then I type in run hr.test ("J", 10); to run this and then press ENTER, and it does nothing. How can I run and create a simple procedure in sql * more
Hello
In addition to all the good points, others have done:
When you issue a SELECT statement in SQL * Plus (or any other front end) two things happen:
(1) a result set, containing the results of your query, is produced, and
(2) this result set is displayed.
Given that these two things are always done together, it is easy to forget that they are two different things.
In PL/SQL, you must explicitly do something to catch the result set, and you must explicitly do something else to view it (if you want to display it).
A simple way to get the result set is to use a cursor FOR loop, to extract a line at a time and run code with this line in a record variable (called the country in the example below).
View the results is to call dbms_output.put_line.
Here is an example:
CREATE OR REPLACE PROCEDURE test
( t IN VARCHAR2
, lmt IN NUMBER -- LIMIT is an Oracle keyword; best not to use it as a variable name
)
IS
BEGIN
FOR country IN ( SELECT country_name
FROM hr.countries
WHERE country_name LIKE t || '%'
AND ROWNUM <= lmt
)
LOOP
dbms_output.put_line ( country.country_name
|| ' = country_name'
);
END LOOP;
END test;
/
SHOW ERRORS
You can use variables, such as t and lmt, in the query without using dynamic SQL, as long as the variables do not have the same names as the columns in the table. In this case, t and lmt are good names; country_name or region_id wouldn't. (In fact, t is a reputable insofar as it cannot be confused with a column in the table of the country. T is not a good reputation in the sense that it does not give much information about what contains the variable, or how it is used. Why not call the variable target_name or name_a_trouver?
You can run the SQL procedure * more like this:
SET SERVEROUTPUT ON
EXEC test ('I', 2);
If you issue the SET SERVEROUTPUT ON command, then you will not see the output of dbms_output. You must only issue the command SET SERVEROUTPUT ON once per session, but nothing bad happens if you do it more than once.
When I ran the procedure as stated above, I got this output:
Israel = country_name
India = country_name
Notice that "The Italy" does not appear, because lmt has 2.
Do not create your own procedures, tables or other objects in the HR schema, or among all the other patterns created by Oracle. Create your own schema and create procedures and other objects in it.
Tags: Database
Similar Questions
-
I'm trying to get my laptop to go wireless and when they ask me the key to my internet source code it keeps incompatibility is my question were can I find the key code
Hello
The password is set in your router. Check with the router manufacturer as most have excellent
online help to set a password as well as connection to the router. Also check in
their forums (if any).Windows wireless and wired network connection problems
http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-WindowsI hope this helps.
Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="">-><- mark="" twain="" said="" it="">->
-
Facebook like button does not work, I used the widget of muse and created the facebook code. Anyone know how to make this work?
Hi connally25,
Here is a link to a video tutorial on how to add a Facebook button, please check if you have followed the same steps to add the video.
http://TV.Adobe.com/watch/learn-Adobe-Muse-CC/adding-a-Facebook-like-button/
If you followed the steps correctly and the button still does not; Here is a link to a forum thread which may help to solve the problem:
Facebook follow Widget does not
Concerning
Sonam
-
As the title says, I'm trying to get this version to work. It was installed but keeps giving me error messages. What Miss me? I have Vista and updated as updates go. I also had to reinstall WinHlp32.exe to access to aid for the program, but it still does not work. Topices (creater of IIFD) has no technical support for me.
Thank you.
As the title says, I'm trying to get this version to work. It was installed but keeps giving me error messages. What Miss me? I have Vista and updated as updates go. I also had to reinstall WinHlp32.exe to access to aid for the program, but it still does not work. Topices (creater of IIFD) has no technical support for me.
Thank you.
Hey Nicsinger
see the list in the center of vista compatibility for your program problem on the link below
If you have any success with it don't try using vista for this compatibility mode by using the information in the belowlink
http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-compatibility-mode/
To configure the compatibility mode for an application, simply locate the installation directory and right click on the .exe, selecting Properties from the menu.
Select the Compatibility tab:
You can choose to run the program in Windows XP compatibility mode, or even all the way back to Windows 95 compatibility.
Walter, the time zone traveller
-
REST: GET using PL/SQL does not not in 4.2.5 OK in 4.2.1
Hello
I have a REST to GET PL/SQL call that verifies an authorization header, performs a routine package which inserts data and then sets the location to a new URL where the customer collects the results of another call from PL/SQL GET REST:
DECLARE l_ref NUMBER; l_authorized BOOLEAN; l_body BLOB := :body; BEGIN IF rest_util.authorized(:authorization) THEN rest_interface.handler(p_content_type => :contentType ,p_body => l_body ,p_ref => l_ref ,p_status => :status); :location := 'results/' || l_ref; ELSE :status := 401; END IF; END;
This works very well in my 4.2.1 instance, but in a 4.2.5 instance it fails with the following text:
Caused by: java.sql.SQLException: ORA-06550: line 1, column 8: PLS-00103: Encountered the symbol "" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor
I also note that the ToolTip for the Type of Source says:
PL/SQL - Executes an anonymous PL/SQL block and transforms any OUT or IN/OUT parameters into a JSON representation. Note that this option is only available when the HTTP method selected is one of the following: DELETE, PUT, POST.
I was just lucky in 4.2.1 or is a documentation error and I should be looking at something else?
Another thought... my work version uses 2.0.1 ADR and ADR 'broken' a 2.0.6. Is the java.sql.SQLException generated by the receiver or the APEX?
Ok... Now I have patched my 4.2.1 system to match the 4.2.5 i.e. same APEX and ADR... and it works very well.
Now, the only difference is that the work system is running on an Oracle 11 g server and the broken one running on Oracle 10 g - is this a problem?
Any other ideas?
Post edited by: query AndyH added about the version of ADR.
Post edited by: AndyH the same message of Type Source appears to 4.2.1 and 4.2.5
Post edited by: AndyH Patched 4.2.1 system to match 4.2.5
It's a possible 10g known 'feature' - If you change a resource on a 10g database you will get the error the «» It seems that the routine that executes the PL/SQL cannot deal with carriage returns. The solution is to remove all your transport returns so the block is a single line. I'll find the bug number when I return to the office.
On the plus side, you can import the restful service to another instance without problem.
Bug 17695075 : RESTFUL SERVICES - CHANGE the error CAUSE CODE
-
SQL comment in "sql * more ' runs inside.
See code below. Why I get after release:
I have enterd only a comment why it comes out as a command? Is there a solution for Sql * more so that he would interpret "/ * aa * /"-style comment as true comment? ".SQL> /*select sysdate from dual*/ SYSDATE ---------- 16.08.2010
SQL*Plus: Release 10.2.0.3.0 - Production on E Aug 16 14:17 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - With the Partitioning, OLAP and Data Mining options SQL> /*select sysdate from dual*/ SP2-0103: Nothing in SQL buffer to run. SQL> select sysdate from dual; SYSDATE ---------- 16.08.2010 SQL> /*select sysdate from dual*/ SYSDATE ---------- 16.08.2010 SQL> /* select sysdate from dual */ SQL> select sysdate from dual; SYSDATE ---------- 16.08.2010 SQL> /* select sysdate from dual; */ SQL> select sysdate from dual; SYSDATE ---------- 16.08.2010 SQL>
I don't know, but it's because
entry has / SQL more will take place the last executed query.
So in / * select sysdate from double * /.
Maybe sqlplus takes just the first and therefore the executed query previously running -
trying to get test drive unlimited to run on windows 7
I've successfully loaded the pc version of test drive unlmt. on our pc that is running windows 7. but when you click to start the game displays the cd turns as it tries to load, after about 10-15 seconds the game window appears for a second then disappears completely and stop trying to load the game. I entered the Compatibility Wizard and selected all versions of vista and xp it and tried to reload the game under these parameters and the same thing happens. I've also selected the compatibility tool and let him try to find the compatible version (he told me vista)...
Thanks for any help or suggestions would be welcome!
Hello
Compatibility of the game Test drive unlimited is not supported with Windows 7, and will be compatible in the coming days, to know more about it, you need to follow this link below.
http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/search.aspx?type=software&s=test%20DRIVE%20unlimited
So the only option you have, is to install XP mode on your computer and then install the game in XP mode and try to play the game.
If you want you can test the XP Mode (if you have the time and the ability to install/reinstall, etc) - download Windows 7 Enterprise 90-day trial. It is designed specifically for the professionals, so we have to say that you are a COMPUTER professional.
http://TechNet.Microsoft.com/en-us/evalcenter/cc442495.aspxThen download and install XP Mode.
If you have Windows 7 Professional/Ultimate/Enterprise you can download and install Windows XP Mode. XP Mode is a virtual XP installation that is running in Windows 7.
Your computer must support virtualization. You can check that your PC hardware works with Windows XP Mode by downloading and running the tool:http://go.Microsoft.com/fwlink/?LinkId=163321
XP Mode home page:http://www.Microsoft.com/Windows/Virtual-PC/default.aspx
If you must enable hardware virtualization on your computer:
1. reboot your computer and enter the BIOS settings.
2. search for the setting of virtualization in the BIOS and enable it.
3. save the BIOS settings and restart your computer.
Warning of the BIOS:
BIOS change / additional metal (CMOS) settings semiconductor oxide may incorrectly
causeserious problems that may prevent your computer from starting properly. Microsoft cannot
guarantee that problems resulting from the configuration of the BIOS/CMOS settings can be resolved. Changes to settings are at your own risk.
After that you can goahead and install the game and check whether the problem is resolved.Thank you, and in what concerns:
I. Suuresh Kumar-Microsoft Support.
Visit our Microsoft answers feedback Forumand let us know what you think. -
limitation in the use of sql * more like a database for applications
Dear expert;
I would like to know everything, what are some of the main limitations using sql * more as your database in the application in addition to designing the user interface is pretty nice... and google does not produce answers to my questions also unfortunatelyuser13328581 wrote:
I don't know about the drivers, I just need an IDE that is very similar to the PL/SQL Developer who will give me the opportunity to create the tables and their relationships and other tasks DDL that is why, at the beginning I was just wondering if it is OK to use sql * more for everything that...Yes, sqlplus allows you to do what you want
-
Try to get updates of vista to run and move 3 steps for each stage.
I have vista home edition and install never updates. I worked through the procedures step by step and everytime I try a procedure, it fails. So I have to step by another procedure to correct this procedure and of course, it fails too, so I have to scroll another procedure to fix the second procedure failed... etc... etc... so I did back off so much, I know not what was up or down more. (Anyway, I spend more time trying to get this computer/operating system to work than to actually produce something with her.)
I used the .net framework cleanup utiility according to the instructions of error code 643. who supposedly worked, so I continued with the instructions to reload the .net framework 3.5 sp1, which was to be followed by a .net framework1.1 which was to be followed by .net framework 1.1 sp1.
The problem is that the reinstallation of .net framework 3.5 sp1 was interrupted because of yet another error. The instructions don't tell me what to do in this case...
can someone tell me what I can do to solve the problem? (other than the obvious answer of 'get' a mac)
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
Ideas:
- You have problems with programs
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
Hi Squirrelgod,
I suggest you uninstall all the facilities of the .NET Framework from your computer by using the .NET Framework cleanup utility again , and then reinstall all versions one by one.
Follow the link below to download the clean utility and all versions of the .NET framework.
When you try to install an update for .NET Framework 1.0, 1.1, 2.0, 3.0 or 3.5, you may receive Windows Update '0 x 643' error code or error code Windows install "1603".
http://support.Microsoft.com/kb/923100
Hope this information is useful.
Amrita M
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think -
I'm trying to get the text to speech reading and have questions what should I do?
I went through the steps to look at the control panel and go to the properties of speech box and click audio output and proceeded with the release of his speech (text-to-speech) I selected the audio device use preferred and I also tried to use this audio output device and not worked in order to test the sound.
I am able to use my itunes and speakers stereo but can't get anything to record that I have a microphone - please help I need to know if I am missing drivers and if so please tell me how to download these drivers or how to get them.
Hello
I suggest you to follow the exact steps in this Microsoft KB article and check if it helps.
How to configure and use text-to-speech in Windows XP and Windows Vista
http://support.Microsoft.com/kb/306902
See also: How to install and configure speech recognition in Windows XP
-
Using the API to connect and create the user
I currently have only the trial for Adobe Acrobat Connect Pro, but I saw on another debate that I should have the full functionality of the API. I have problems with the record as an administrator and creating a user. My response xml does not match what the documentation says I should get. When I try to log in I get status code = 'ok', but when I try to create a new user I have status not available to the code. However, this user is an administrator.
Call the #1:
Result:
<? XML version = "1.0" encoding = "utf-8"? >
< results > < status code = 'ok' / > < local commune = "in" time-zone-id = "85" time-zone-java-id = "UTC" > < cookies > na8breez8mky3nb7tvvda8tn < / cookie > < date > 2013-05-07T 00:35:2 7,610 + 00:00 < / date > < host > https://meetxxxxxxxx.adobeconnect.com < / host > < localhost > pcpna8app04 < / local-host > < admin-host > na8cps.adobeconnect.com < / admin-host > < url > /api/xml?domain=meetxxxxxxxx.adobeconnect.com & amp; action = common-info < / url > < version9 >. 0.4 < / version > < tos-version > 7.5 < / tos-version > < true reviews-product > < / product-notice on > < account account id = "xxxxxxxxxx" / > < / common > < reg-user > < East - reg > - false < / East-reg-user > < / reg-user > < / results >
Call the #2:
Result:
<? XML version = "1.0" encoding = "utf-8"? >
< results > < status code = 'ok' / > < / results >
Call the #3:
Result:
<? XML version = "1.0" encoding = "utf-8"? >
< results > < status code = subcode "lack of access" = "no-login" / > < / results >
Looks like you do things out of order. You should start with the login call (#2) and then use the common-info call (#1) to get your session cookie id. It may be that you are using an invalid session cookie on before you connected.
In addition, you have a lot of extra things to your calls. You don't need the field = value xxx. Clearly explained in the documentation here (http://help.adobe.com/en_US/connect/9.0/webservices/WS5b3ccc516d4fbf351e63e3d11a171ddf77-7 ff5_SP1.html).
-
Create a simple procedure that can be used to send emails
Dear all, I would like to design a simple procedure that allows you to send emails... How can I go to do it. Please note, that I have a table called table_emp that contains the emails of employees there and their firstname, lastname, empid, username, email, username, Userid so
All will be greatly appreciated. Thank youUserid FirstName LastName empid Email username Manager 123 John Adams 550 [email protected] jadams 0 124 Lisa Rain 551 [email protected] lrain 1 125 Mesina Ray 552 [email protected] mray 1
You should use packages utl_smtp and utl_mail in your code for sending mails.
Read the below links fo more information:
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/u_mail.htm
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/u_smtp.htm -
get EST for sql without running against PB? possible?
Hello
is there anyway to get a query run time without running on the database? even an estimate would be good... I'm on 10.2.0.3... .i am it might be impossible for... but anyway to get the estimate and more setting autotrace only? as I said, they don't want anything but as an estimate for how long time will it take to complete the query... I know we can see very long_ops but like I said... without running against the DB... .is it possible? as the command explain plan that I have watch time? but is that how long it will take to finish or? /
Select * from table (dbms_xplan.display);----------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 56 | 3192 | 9 (0)| 00:00:01 | | 1 | MERGE JOIN CARTESIAN| | 56 | 3192 | 9 (0)| 00:00:01 | | 2 | TABLE ACCESS FULL | DEPT | 4 | 80 | 3 (0)| 00:00:01 | | 3 | BUFFER SORT | | 14 | 518 | 6 (0)| 00:00:01 | | 4 | TABLE ACCESS FULL | EMP | 14 | 518 | 2 (0)| 00:00:01 | -----------------------------------------------------------------------------
The theory is that 'time' in an explain Plan is an estimate.
However, it is so very dependent on
a. statistical system and correct assessment of the speed of the CPU, SingleBlockReadTime and MultiBlockReadTime
b. table, column, index and estimates appropriate size statistics and the number of blockreads for the execution plan
c. cardinality ("Rows") is estimated at each stage of the particular execution planWhat is, in most cases, the entry "wrongest" is the cardinality estimate and that changes everything.
I would use 'time' in a Plan with the exception of the simplest to explain SQL statements and good statistics on the table (however multi-column predicates can still cause bad cardinality estimates).
Therefore, I would use the estimation of 'Time' almost never. -
I get Windows search is not running and awaiting receive indexing status
If I put all the discs in my laptop, they usually play and I keep getting the message windows search is not running. When I click on start, all programs, click Windows search to start, nothing happens.
Hello
1. what exactly happens when you try to play any CD? You get the error message?
2. don't you make changes on the computer before this problem?
3. do you get this error on windows search only when you insert any CD in the drive?
4. what player do you use?
5. What is the accurate and complete error message?In response to the questions above could help us help you better.
You try to run the Fixit of the article below and check if it helps.
Fix Windows Search when it crashes or shows no results
http://support.Microsoft.com/mats/windows_search/en-us -
I got a toolbar at the top of the Firefox page which had a single thing about it and I wanted to close or delete this toolbar, and I have deleted or closed that bad. Now, one with file, editing, tools, etc. is missing and I don't know how to get it back. Can you help me?
- Try Alt (press keyboard) and then in turn, V, T, M
- See also the Navigation buttons such as back, home, bookmarks and recharge are missing
- and controls, buttons and Toolbars Customize Firefox
Pressing Alt poster temporarily the menu bar, the other keys select the option set menu toolbar to display bar.
It should still work in Firefox 4, which has a firefox button, Alt temporarily displays the menu and the firefox button bar.
According to what has happened, you will need to use customize/customize to make other changes or even restore default, perhaps even to start Firefox in Safe Mode troubleshooting questions or study if another plugin affecting behavior of firefox.
Maybe you are looking for
-
Menu bar disappears in Snow Leopard for Mac
The Menu bar on my iMac disappears when I open Firefox 36.0.1. If I move the Firefox window, then click on top of the screen the menu bar of the Finder returns but it's annoying to have to do this. The Firefox menu bar does not appear.I deleted the r
-
It is for information purposes. I installed Acrobat plug today 10.1.3 and I get a blank tab while trying to open a PDF in Firefox 11.0. This plug in works in Safari. I've disabled the plug into Firefox and installed the extension form PDF viewer 0.2.
-
Satellite A500-149: full removal of Mcafee
HelloI want to completely remove the Mcafee to install kaspersky 09. I go to the Panel and I remove McAfee. OK, and then restart the A500. When I go to install Kaspersky 2009/2010, the installation is interrupted by a conflict to say remove McAfee, w
-
Card LaCie esata PCI card on windows 2003 server Dell poweredge T410 error code 10
Hi guys, I am trying to install a new card Lacie esata PCI card (http://www.lacie.com/products/product.htm?pid=11217) on windows server 2003 on Dell poweredge T410. Windows detects the card and install the driver, but then, it shows an error code 10
-
With ESSBASE integration possibilities
HelloI want to create reports using essbase, but my data are in dataware House.How do I take the data from the Data Warehouse and store it in essbase? What tools do I need? Should what steps I use?Can someone guide me in the right directionConcerning