avatar
Stored Procedure?# Database - 数据库
p*a
1
数据库APPLICATION PROGRAMMING,比如C程序调用SQL,
只用STORED PROCEDURE,够不够?
我的意思是程序中不出现SELECT 。。。,一切数据库操作都是
对STORED PROCEDURE的调用,可不可以?会有什么问题?
请高手指教
avatar
s*k
2

Of course you can. But that is not a good database programming
practice.You may need to create too many stored procedures on
server and some only too trivial to bother your DBA to
create and consume system resource of server.

【在 p******a 的大作中提到】
: 数据库APPLICATION PROGRAMMING,比如C程序调用SQL,
: 只用STORED PROCEDURE,够不够?
: 我的意思是程序中不出现SELECT 。。。,一切数据库操作都是
: 对STORED PROCEDURE的调用,可不可以?会有什么问题?
: 请高手指教

avatar
a*i
3

Depends on what you need them for.
1: If you need a lot of interactive actions between your database and the
server, it is better to write the application in C/Perl/Java/whatever
language you are familiar with.
2: Otherwise, stored procedure runs faster. I dont know about in other DBs,
but Oracle's store procedure has a pretty well defined control structure in
which you can pretty much do everything you need to do .
3: You can not have DDL in stored proecedure body. That is a drawback.

【在 p******a 的大作中提到】
: 数据库APPLICATION PROGRAMMING,比如C程序调用SQL,
: 只用STORED PROCEDURE,够不够?
: 我的意思是程序中不出现SELECT 。。。,一切数据库操作都是
: 对STORED PROCEDURE的调用,可不可以?会有什么问题?
: 请高手指教

avatar
p*a
4
Thanks. I will use Stored Procedure for SQL only.
As you said , DDL cannot be put in SP.
But I doubt if I can put dynamic SQL in it?
How about CLI? For example, a web search engine needs to
form queries on the fly, can I use SP in this case?
Thanks again!

【在 a*****i 的大作中提到】
:
: Depends on what you need them for.
: 1: If you need a lot of interactive actions between your database and the
: server, it is better to write the application in C/Perl/Java/whatever
: language you are familiar with.
: 2: Otherwise, stored procedure runs faster. I dont know about in other DBs,
: but Oracle's store procedure has a pretty well defined control structure in
: which you can pretty much do everything you need to do .
: 3: You can not have DDL in stored proecedure body. That is a drawback.

avatar
a*i
5
Oracle supports Dynamic SQL. So, go ahead and stop worrying:)
I am not sure how good the performance is though. I had done
some scripting in dynamic SQL, but the table was relatively small,
so the performance was really not a big issue there.

Hmm In that case, the best choice is to use Oracle webserver.
(I dont work for Oracle, btw.)

【在 p******a 的大作中提到】
: Thanks. I will use Stored Procedure for SQL only.
: As you said , DDL cannot be put in SP.
: But I doubt if I can put dynamic SQL in it?
: How about CLI? For example, a web search engine needs to
: form queries on the fly, can I use SP in this case?
: Thanks again!

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。