允许最终用户键入-pl/sql [英] enable an end user to type in - pl/sql

查看:72
本文介绍了允许最终用户键入-pl/sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个PLSQL程序以使最终用户能够键入customer_ID.显示客户从销售表中购买的唯一product_ID的列表.

I need to Write a PLSQL program to enable an end user to type in the customer_ID. Display the list of unique product_IDs that customer purchased from the sales table.

BEGIN
  FOR p IN (SELECT unique product_id FROM sales)
  LOOP
    dbms_output.put_line( 'Customer ID: ' || p.product_id );
  END LOOP;
END;

我解决了显示唯一值的第二部分,如下所示,但不确定如何使最终用户键入customer_id?帮助

I have solved the second part of displaying the unique values as follows but not sure how to enable an end user to type in the customer_id?? help

推荐答案

在PL/SQL块中,您可以将&"符号用作占位符.像这样:

You can use the ampersend (&) sign as a placeholder in your PL/SQL block. Like this :

BEGIN
  FOR p IN (SELECT unique product_id FROM sales WHERE customer_id = &1)
  LOOP
     dbms_output.put_line( 'Customer ID: ' || p.product_id );
  END LOOP;
END;

这篇关于允许最终用户键入-pl/sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆