My First while loop inside PL/SQL block not working , please help
Hi ,
I am new to PL/sql and struck at PL SQL blocks , please help to solve this .
declare
v_A number constant :=10 ;
j number constant := 3 ;
BEGIN
WHILE j < v_A
LOOP
DBMS_OUTPUT.PUT_LINE('Hai');
END LOOP;
END;
please help as how to resolve this .
Thanks in advance .
btw it's a useful habit to use indentation to highlight the block structure. Also it's worth deciding what your convention will be for keywords (I use uppercase, lowercase is also fine as far as I'm concerned but I've set up my editor to uppercase them) and variables, database object names etc (I use lowercase), e.g:
DECLARE
v_a CONSTANT PLS_INTEGER := 10;
j CONSTANT PLS_INTEGER := 3;
i PLS_INTEGER := j;
BEGIN
WHILE i <= v_a LOOP
DBMS_OUTPUT.PUT_LINE(i);
i := i +1;
END LOOP;
END;or perhapsdeclare
v_a constant pls_integer := 10;
j constant pls_integer := 3;
i pls_integer := j;
begin
while i <= v_a loop
dbms_output.put_line(i);
i := i +1;
end loop;
end;When I see "declare" and "BEGIN" in the same block of code I worry about the standard of code I'm going to see...
Similar Messages
-
while updating 4.0 version to 5 version system shows sim card is not valid. My iphone is not working .Please help me
I would imagine your iPhone was hacked to make it work on your local carrier.
Updating the iOs to 5.xx will lock it back to the original carrier .The carrier holding the lock are the only
entity able to authorise the unlock .You will have to contact them and see if they unlock and the terms the apply -
My first PL/SQL block not working with using Select query within begin
I am new to PL/SQL , just started with basics of BLOCKS .
I am having a query here in executing a block .
When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
First of all This is my Table :
select from try :*
KEY VALUE
Key Value
Key1 Value1
Key2 Value2
Key3 Value3
======================
This is the code which is not working : Please see the code and tell me what is the problem .
DECLARE
v_KEY VARCHAR2(20);
v_VALUE VARCHAR2(20);
BEGIN
select key into v_KEY FROM try where v_value='Value' ;
dbms_output.put_line(v_KEY);
END;
When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
wheer when i run tis individually it worked fine :
select KEY FROM try where VALUE='Value' ;"
please share your ideas .as why it isn't running ??
Edited by: user10503747 on Sep 20, 2010 3:16 AMHi,
user10503747 wrote:
I am new to PL/SQL , just started with basics of BLOCKS .
I am having a query here in executing a block .
When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
First of all This is my Table :
select from try :*
KEY VALUE
Key Value
Key1 Value1
Key2 Value2
Key3 Value3
======================
This is the code which is not working : Please see the code and tell me what is the problem .
DECLARE
v_KEY VARCHAR2(20);
v_VALUE VARCHAR2(20);
BEGIN
select key into v_KEY FROM try where v_value='Value' ;
dbms_output.put_line(v_KEY);
END;
When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
wheer when i run tis individually it worked fine :
select KEY FROM try where VALUE='Value' ;"
please share your ideas .as why it isn't running ??
Edited by: user10503747 on Sep 20, 2010 3:16 AMInstead of:
{code}
select key into v_KEY FROM try where v_value='Value' ;
{code}
perhaps you meant something like:
{code}
v_value := 'Value1';
select key into v_KEY FROM try where v_value=Value ; -- No quotes
{code}
Until you assign a vlue to a variable, like v_value, it is NULL, so your original statement was equivalent to
{code}
select KEY FROM try where NULL='Value' ;
{code}
In PL/SQL, a SELECT ... INTO statement must return exactly one row, or else you will get an error (either NO_DATA_FOUND or TOO_MANY_ROWS). This is different from SQL, where a query cn return any number of rows, including 0, without raising an error. -
the following sql is not working . If sum(salary) = null should be displayed 1 or 0
select empname,iif((isnull(sum(salary),0)),1,0) from salary group by empname
regards
Pol
polachanI think what you're looking at is this
select e.empname,
COALESCE(s.totalsal,0) as salary
from employee e
left join (select empname,sum(salary) as totalsal
from salary
group by empname
)s
on s.empname = e.empname
where employee represents your master table containing employee information
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Event controll: How to stop a running while loop inside a event structure
Hello,
I have some problems with controlling a while loop inside a event structure (see attached VI).
I habe 3 buttons ("Start Measurement, Stop Measurement, Quit Program"). When a measurement is running, it should be possible to stop the measurement by clicking on "Stop Measurement", but this does not work.
Has anyone an idea?
Thanks a lot and best regards,
Michael
Message Edited by MichaGue_01 on 04-23-2010 04:37 AM
Solved!
Go to Solution.
Attachments:
Event_Controll.vi 27 KBHello,
Try not to use while loops inside a Event structure.
My approach is using two While loops (one will have only the Event structure).
I had to use to Flag buttons that make it a bit more complicated but i am sure somebody will come up with a better idea, or you might want to have a think about it yourself.
Have a look on the modified version on the attachment.
Once you are happy how it works then you can Hide the 2 flag buttons from the Front Pannel by going to Block diagram right-click the indicators and choose option "Hide Indicators/Controls"
I did it in LV 8.6 so i hope you can open it on your PC if not i can downgrade it.
If you have any problem let us know.
Regards
Dimitrios
Test Systems Computing Engineer
Cummins Turbo-Technologies
Attachments:
Event_Controll[1]_modified.vi 18 KB -
Exit a while loop inside an event case
Hi All, I have a multi-page program. One of it is used to read some analog signal via a USB block continuously.
What I want is when clicking this page, this while loop is activated. Then we can monitor the data. When we click other pages or "Stop" button, this while loop will be terminated. And we can use the other pages to do something else.
Right now I got difficuties in stop the while loop. I do not want to stop the running of the whole program, just want to jump out of this while loop then do other operation.
Could anyone give me some advise how to do it? Thank you very much!Hi RavensFan, thank you for your reply.Actually this is not my real code because the original one is very very compliacted.
In real code, the tab control you see in inside the bigger while loop, that loop makes the whole program work.
And as what I pointed, the purpose is when I click this tab (if we do not want it to trigger, we can place another "START" button to trigger), an internal while loop inside begins to run. This while loop keeps showing the real time analog signal.
And if I do not want to use this "real time monitoring" function, I want to click somewhere (or doing anything else that can work) to jump out of this internal while loop and keep on using some other functions of the program.
Could you advise about that? Thank you very much! -
Can't we use while loop inside a fn
i am using a while loop inside a fn
it is showing error
the code is
while (a=1) loop
some condition
end loop;
the error is
PLS-00103: Encountered the symbol "WHILE" when expecting one of
the following:
* & = - + < / > at in is mod not rem then <an exponent (**)>
<> or != or ~= >= <= <> and or like between overlaps || year
DAY_
The symbol "*" was substituted for "WHILE" to continue.
PLS-00103: Encountered the symbol "LOOP" when expecting one of
the following:
. ( * % & = - + < / > at in is mod not rem then
<an exponent (**)> <> or != or ~= >= <= <> and or like
between ||
what is the errorIt looks like the OP misskeyed the assignment operator and got compilations errors, and from that assumed that you can't use WHILE loops in functions on a Tuesday.
Message was edited by:
William Robertson
I was thinking of his is it possible to increment a value in a function, though I suspect the problem is similar. -
While loop inside a timed loop
Hi everybody!
I'm using:
- LV 7.1 + RealTime;
- compactFieldpoint;
I've noticed a strange behaviour, when I put a while loop inside a timed loop. Let's fix timed loop with these settings:
- 1 KHz clock
- 1 ms period (yes, I know it's short....)
- offset 0 ms
- Phase 0
- Discard missed period (ON) and MAintain original Phase (ON);
- Timeout: -1.
If inside this loo, I put a traditional while loop, waiting (say) for an event to occur, and if this event does not arrive, my cFP-2020 hangs! I mean, it becomes unreachable for the debugger, and, more, if I run a ping to it's address, after some cycles it becomes unreachable also from ping!
Clearly, this code statement lock the fieldPoint, because if I remove the inner while loop all works.
I know that with 1 ms period, timed loop always finishes late, but I set to discard missed period and timeout to -1.
It seems to me that sometimes Timed Loop add heavi overhead to programs, I'm turning to all while loop based tasks, even if my application has to be real-time!
Advices welcomed! Have a nice day!
graziano
Solved!
Go to Solution.I think the issue here is that putting your while loop inside a Timed Loop increases the priority for that task. Timed Loops can have dynamic priorities set over eachother, but they all run between Above Normal and Time Critical priority. My guess is that the debugger and built-in TCP functions run at Above Normal priority or less. This means your cFP isn't hanging, it's doing what it thinks is best. It's trying to finish this task before handling any lower-priority tasks.
The suggestion to put a Wait function in your loop is an OK one. Keep in mind that you can actually set your wait time to zero instead of one and get the same positive benefit of handling other tasks. I would also suggest that you might look into waiting for this event in a lower priority (non-Timed) loop, and then transmit the appropriate data to your Timed Loop using an RT-FIFO or something. That might give you better handling. Just a thought....
Jarrod S.
National Instruments -
this afternoon glass of my iphone 5c runs out .. half the time pushed back inside but I am scared .. please help me. thank you
Welcome to the user to User Technical Support Forum provided by Apple
You need to take your Device to an Apple Store or AASP (Authorized Apple Service Provider). Be sure to make an appointment first... -
CSS transition 'left' for ':before' block not work
CSS transition 'left' for ':before' block not work.
Some css rules:
http://www.screencast.com/t/f2MaN5TRpY
Video of working in firefox:
http://www.screencast.com/t/YMBKR77kAQ
Video of working in google chrome:
http://www.screencast.com/t/yOc8tN7yZcAIs it just the left property that doesn't work?
I found an old bug from 2010 where transition was first made to apply to generated content, but I don't know the details of which properties were tested: [https://bugzilla.mozilla.org/show_bug.cgi?id=555627 555627 – CSS Transition Cannot Be Applied to :before/:after insertions]. -
My app store is not working after installing mavericks. When I open app store it repeatedly asking me to login with apple ID and to provide User name and Password for proxy authentication in a loop.I am a newbie to mac,Please help me.
Hmmmm... would appear that you need to be actually logged in to enable the additional menu features.
Have you tried deletting the plists for MAS?
This page might help you out...
http://www.macobserver.com/tmo/answers/how_to_identify_and_fix_problems_with_the _mac_app_store
Failing that, I will have to throw this back to the forum to see if anyone else can advise further.
Let me know how you get on?
Thanks. -
What will you do if any SQL is not working. in oracle 10g....apps 11.5.10.2
928714 wrote:
yes sir.If you help me in answering my questions i wll be very thankful to you sir.
tnx,I haven't a clue.
As you have been advised in many of your posts, go study the documentation for whichever specific topic you are interested in.
For me to answer your questions, I would need to go get that documentation.
Then I would need to read that documentation.
Then I would need to write a forum post that interprets what I think I learned from that documentation.
It is so very much faster if YOU go do that instead of posting to a forum and expecting others to do it. You will remember what you study for a lot longer time if you teach yourself. -
hi..i just bought an iphone 5 yesterday 32GB..and now when i am trying to update the software..it says the following: unable to check for update/an error occurred while cheking for a software update...please help me..is it a problem in my new iphone??or it's just an temporary error in the apple software center???
Lyndsay237 wrote:
This device does not have a sim card in it. Could this be the reason or am I missing something when I am trying to update.
Yes. You can't update or restore any GSM iPhone without a valid sim card installed in the phone. The sim card need not be activated, but it must be valid & present. If you want to update, you need to get a sim card. -
it's been a while that Im unable to copy music from itunes to my iphone. I updated my device to the latest version of IOS 5.1.1 and made sure no jailbreak is installed but still not working. please assist.
Assuming you are not manually managing your music, verify the following:
You are using the latest version of iTunes
On the summary tab of your iTunes sync settings you have checked "Sync only checked songs and videos"
In your music library you have checked all the songs you want to sync to your phone
There are no exclamation points next to any of the songs you want to sync to your phone
You have authorized your computer for all Apple IDs for purchased music you want to sync to your phone (in Store>Authorize this computer)
You have checked "Sync Music" on the Music tab of your iTunes sync settings
When everything looks correct, sync your phone. -
Exceptions in popup blocking not work good
why sub-domains in exceptions in popup blocking not work? if i add a particular subdomain it works, but when i add an star in subdomain to do for all not work:
*.mihanblog.com
*.blogfa.com
//// Please add image upload on post feature to Firefox's support ////
//// Also add a suggestion forum to Firefox's support (like Chrome's forums) ////
ThanksDo not add a * because Firefox doesn't support wildcard that way.<br />
Just specify the domain to apply the exception to a domains and all sub domains.
*Bug 336207 - Add wildcards to cookie exceptions list to permit subdomains if all cookies are blocked
Maybe you are looking for
-
How do I get my films into iTunes library , there r in mp4 format but will not load to itines
I have converted my films to mp4 format but they still will not load yo My iTunes library can anyone advise how to sort this out Thanks
-
JSF and Hibernate Lazy loading
Hello, It seems like Hibernate session is being closed after exception. This makes a conflict with JSF, since after session is closed lazy initialization cannot take place and the view of the page cannot be rendered. Is it right that Hibernate sessio
-
HI experts, I have to implement BI and in the new BI server my manager has asked me to check the BI server, Please tell me what will I have to do? regards. man
-
hı how can I know the sıze of all datafiles?
-
Can not find javax.ejb.CreateException when lookup and create EJB instance.
Hi, I installed SAP CE 7.2 and NWDS 7.2. When i call create() of EJB's home interface from JAVA stand alone app to create EJB instance, the complier state that it need 'javax.ejb.CreateException'. How can i find the jar that contain 'javax.ejb.C