SQLPlus 中存储过程的正确语法是什么?

发布于 2024-12-09 01:24:25 字数 523 浏览 0 评论 0原文

在 sqlplus 中编写存储过程的正确语法是什么?令人惊讶的是,互联网在这一点上毫无帮助,因为 SQL 教程似乎没有指定他们的环境,或者他们给出的示例有点令人困惑。我认为解决这个问题的最简单方法是,我将发布两个命令(我需要执行的几个命令中的一个),如果有人可以将它们编写为存储过程,我相信我可以计算出其余的命令我自己出去。

命令1: 代码:

SELECT COUNT(username)
FROM "ValidClients"
WHERE username = [username goes here];

命令 2: 代码:

INSERT into "ValidClients"
/*zero is overridden by a sequence trigger*/
VALUES (0, [username], [password]);

如您所见,这确实是基本的东西,我只是习惯了 Microsoft SQL Server,所以 SQLPlus 语法让我有点困惑。提前致谢。

What's the proper syntax for writing stored procedures in sqlplus? The internet is surprisingly unhelpful on this point since SQL tutorials don't seem to specify their environment, or the example they give is a little confusing. I think the simplest way to figure this is that I'll post two commands (out of several I need to make), and if someone can write what they'd look like as stored procedures, I'm sure I can figure the rest out on my own.

Command 1:
code:

SELECT COUNT(username)
FROM "ValidClients"
WHERE username = [username goes here];

Command 2:
code:

INSERT into "ValidClients"
/*zero is overridden by a sequence trigger*/
VALUES (0, [username], [password]);

As you can see, it's really basic stuff, I'm just used to Microsoft SQL Server and so SQLPlus syntax is tripping me up a little. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み格子的夏天 2024-12-16 01:24:25

以下是来自 Google 的示例

CREATE PROCEDURE addtuple1(i IN NUMBER) AS
BEGIN
    INSERT INTO T2 VALUES(i, 'xxx');
END addtuple1;

整个教程看起来不错。

Here's an example from Google:

CREATE PROCEDURE addtuple1(i IN NUMBER) AS
BEGIN
    INSERT INTO T2 VALUES(i, 'xxx');
END addtuple1;

The entire tuturial looks kindof nice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文