如何使用oracle xe制作oracle程序,如何检查输入是否有效?例如:如果我的输入是数字,并且我输入 char,那么该过程会打印出一些内容,在这种情况下,我已经处理过 SQL,但没有处理过此类过程?感谢任何帮助
更新
这是一个虚拟示例..我的意思是从最简单的事情开始,然后继续进行更复杂的示例,我真正需要的是检查table books
中的 >field book 等于 0,则停止借用查询
进行插入,否则插入。
how can I make oracle procedure with oracle xe, how can I check if input is valid or not? ex: if my input is number and I type in char that procedure prints out something in that case, I've dealt with SQL but not with these kind of procedures? any help is appreciated
UPDATE
This was a dummy example .. what I meant is to start from the most simple thing then move on up to the more complicated examples, what I actually need is check if a field book
in table books
equals 0 then stop borrowing query
to insert else insert.
发布评论
评论(4)
这是我认为您想要的那种过程的示例。我不得不做出一些(我希望是有根据的)猜测来填补你的例子中的空白。
Here is an example of the sort of process I think you want. I have had to make a couple of (I hope educated) guesses to fill in the gaps in your example.
您的问题听起来不像您需要 PL/SQL。
单个 SQL 插入应该可以(如果我正确理解你的问题):
如果你仍然需要一个过程,请将其放入一个过程中:
尝试避免在 PL/SQL 中循环游标并插入值,当它可以在单个 SQL。
Your problem does not sound as if you would need PL/SQL.
A single SQL-insert should do (if I understand your question right):
If you still need a procedure, put that into a procedure:
Try to avoid looping over a cursor in PL/SQL and inserting values, when it could be done in a single SQL.
您的存储过程参数已经是强类型的。如果你有一个“int”参数,有人输入“ABC”作为值,Oracle 会完成它。你不必/需要。
You stored procedures parameters are already strongly typed. If you have an "int" parameter someone types in "ABC" for the value, Oracle will through it out. You won't have to/need to.
像这样的东西吗?
Something like this?