SQL*Plus how to accept text variable from prompt?(SQL*Plus 如何从提示中接受文本变量?)
问题描述
我是 psql 的初学者,我有一个问题.
Im very beginner in psql and i have a question.
代码如下:
问题很简单:如何将文本传递给我的变量?如果我输入一个数字,它可以正常工作并且我可以在日志中读取我的数字,但是如果我传递像mytext"这样的文本而不是数字,我会收到一个错误:
Question is very simple: How can i pass text to my variable? If i input a number it is works correctly and i can read in the log my number, but if i pass a text like "mytext" instead of a number, i got an error:
推荐答案
您必须指定数据类型作为 接受声明.如果没有给出,则假定一个数字.
You have to specify the data type as part of the ACCEPT statement. If none is given, it assumes a number.
尝试 ACCEPT myVariable CHAR PROMPT 'Input value: ';
代替.
这篇关于SQL*Plus 如何从提示中接受文本变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!