Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does foxpro allow scripts like the begin..end in oracle 3

Status
Not open for further replies.

inncoggnitto

Programmer
Jun 19, 2001
77
US
I want to wrap up a bunch of append from and update statements into a script so that they run all at once.

the help for fp does not list begin as a function.

 
I want to wrap up a bunch of append from and update statements into a script so that they run all at once

I think perhaps Jim has gone one step too far for you. The Fox equivalent of a script is a program. If you put all your commands into a file named myprog.prg then you can run them with DO myprog.

Geoff Franklin
 
i am not sure that would work in command sql window

i tried this

begin
update adjust_2 set bi_prev_qt = 0;
update adjust_2 set bi_prev_pr = 0;
update adjust_2 set bi_add_qt = 0;
update adjust_2 set bi_add_pr = 0;
update adjust_2 set bi_ttl_qt = 0;
update adjust_2 set bi_ttl_pr = 0;
end

and i get 'command encountered unrecognized word or phrase'.

not sure what to use in the do while ###
 
so, geoff

if i save this*************
update adjust_2 set bi_prev_qt = 0;
update adjust_2 set bi_prev_pr = 0;
update adjust_2 set bi_add_qt = 0;
update adjust_2 set bi_ttl_qt = 0;
update adjust_2 set bi_ttl_pr = 0;
****************
as myprog.prg and call from the command line

do myprog.prg it should run?

does foxpro use the ; at the eol like oracle and other sql?
 
You should be writing the commands in a program, not in the Command Window.

If you type [TT]MODIFY COMMAND[/TT] in the Command Window then the editor will open and you can type your commands:
Code:
update adjust_2 set bi_prev_qt = 0
update adjust_2 set bi_prev_pr = 0
update adjust_2 set bi_add_qt = 0
update adjust_2 set bi_add_pr = 0
update adjust_2 set bi_ttl_qt = 0
update adjust_2 set bi_ttl_pr = 0
No begin or end, no semi-colons.

Save your program as myprog.prg then type [TT]DO myprog[/TT] in the Command Window to run it.

Geoff Franklin
 
You can either save this as a program and call it, as you said, from the command line, it should run all at once.

Or, alternatively, you can just put your commands in the command window, just the

update adjust_2 set bi_prev_qt = 0
update adjust_2 set bi_prev_pr = 0
update adjust_2 set bi_add_qt = 0
update adjust_2 set bi_add_pr = 0
update adjust_2 set bi_ttl_qt = 0
update adjust_2 set bi_ttl_pr = 0

not begin-end; select with your mouse all the lines at once, right-click on the selection, and choose Execute Selection from the menu that appears. Done.

As for semicolon, Foxpro doesn't require it at the end of the line, only if you have to continue the command on the next line you put semicolon to show that this is not the end.
 
way cool. thanks to both of you.

it worked in an instant.

merry christmas and happy holidays from texas (whichever you prefer)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top