我在编写程序时遇到一些麻烦,该程序显示了在给定ID作为输入时名称在数据库中出现的次数。例如,如果您键入1,它将与数据库中出现两次的姓氏相对应,因此它应打印出' 2'。我的问题是我不知道如何显示名称最后出现的次数。贝娄是我到目前为止的代码。
<%@ Control language="vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %>
<%@ Register TagPrefix="dnn" TagName="SEARCH" Src="~/Admin/Skins/Search.ascx" %>
<%@ Register TagPrefix="dnn" TagName="LANGUAGE" Src="~/Admin/Skins/Language.ascx" %>
<%@ Register TagPrefix="dnn" TagName="LOGO" Src="~/Admin/Skins/Logo.ascx" %>
<%@ Register TagPrefix="dnn" TagName="USER" Src="~/Admin/Skins/User.ascx" %>
<%@ Register TagPrefix="dnn" TagName="BREADCRUMB" Src="~/Admin/Skins/BreadCrumb.ascx" %>
<%@ Register TagPrefix="dnn" TagName="LOGIN" Src="~/Admin/Skins/Login.ascx" %>
<%@ Register TagPrefix="dnn" TagName="COPYRIGHT" Src="~/Admin/Skins/Copyright.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TERMS" Src="~/Admin/Skins/Terms.ascx" %>
<%@ Register TagPrefix="dnn" TagName="PRIVACY" Src="~/Admin/Skins/Privacy.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TEXT" Src="~/Admin/Skins/Text.ascx" %>
<%@ Register TagPrefix="dnn" TagName="JQUERY" Src="~/Admin/Skins/jQuery.ascx" %>
<%@ Register TagPrefix="dnn" TagName="META" Src="~/Admin/Skins/Meta.ascx" %>
<%@ Register TagPrefix="dnn" TagName="MENU" Src="~/DesktopModules/DDRMenu/Menu.ascx" %>
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<dnn:META ID="mobileScale" runat="server" Name="viewport" Content="width=device-width, initial-scale=1.0" />
<dnn:DnnCssInclude ID="DnnCssBootstrap" runat="server" FilePath="Scripts/css/bootstrap.min.css" PathNameAlias="SkinPath" />
<dnn:DnnCssInclude ID="DnnCssmmenu" runat="server" FilePath="Scripts/css/jquery.mmenu.all.css" PathNameAlias="SkinPath" />
<dnn:DnnCssInclude ID="DnnCssSimplesidebar" runat="server" FilePath="Scripts/css/simple-sidebar.css" PathNameAlias="SkinPath" />
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<nav id="menu">
<dnn:MENU ID="mmenuNav" MenuStyle="mmenu" runat="server"></dnn:MENU>
</nav>
</div>
<!-- /#sidebar-wrapper -->
<div id="page-content-wrapper" style="background-color:#F5FAFA;">
<div class="container" style="background-color:#F5FAFA;">
<div id="ContentArea" class="col-xs-12 col-sm-12 col-md-12">
<a href="#menu-toggle" class="btn btn-default" id="menu-toggle" style="margin:15px;">Navigation Menu</a>
<div id="ContentPane" runat="server"></div>
</div>
</div>
</div><!--/.container-->
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
}); <!-- Toggle for Left Side Menu -->
$("#menu").mmenu({
"offCanvas": false,
"iconPanels": true,
//"slidingSubmenus": false,
"navbar": {
"title": "Menu Title"
},
navbars : [{
height : 4,
content : [
'<div style="text-align:center;"><img src="/Portals/0/Images/ProfilePicture.png" height="160" width="128" /></div>'
]
}, true],
"extensions": [
"effect-panels-zoom",
"multiline"
]
});
});
</script>
<dnn:DnnJsInclude ID="DnnJsmmenu" runat="server" FilePath="Scripts/js/jquery.mmenu.all.min.js" PathNameAlias="SkinPath" ForceProvider="DnnFormBottomProvider" />
<dnn:DnnJsInclude ID="DnnJsBootstrap" runat="server" FilePath="Scripts/js/bootstrap.min.js" PathNameAlias="SkinPath" ForceProvider="DnnFormBottomProvider" />
答案 0 :(得分:0)
问:“......最后如何展示......”
要显示“{1}}缓冲区”的内容,客户端需要从缓冲区中读取并进行显示。
如果我们从SQL * Plus命令行客户端运行,我们可以发出
DBMS_OUTPUT
在执行匿名块之前的语句。为了实现这一点,我将其简化为一些非常简单的事情,然后再调用存储过程。
set serverout on
确保按照我们的预期工作。然后我们可以继续显示更有用的内容,调用存储过程,无论如何。
参考:http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve040.htm#SQPUG099
注意:这适用于SQL * Plus命令行客户端。其他客户端(例如T.O.A.D)有其他机制来显示DBMS_OUTPUT缓冲区的内容。
答案 1 :(得分:0)
您可以在Oracle
中编写您的程序,如下所示。这将输入1作为输入,并列出具有相同姓氏的所有stuednts与具有Id=1
的学生相同;
CREATE OR REPLACE PROCEDURE ZRBIDInput (StudentID IN VARCHAR2 )
IS
numberOfStudents NUMBER;
BEGIN
SELECT COUNT (*)
INTO numberOfStudents
FROM ZRB_STUDENT
WHERE Lastname = (SELECT Lastname
FROM ZRB_STUDENT
WHERE ID = StudentID );
dbms_output.put_line('Num Of Students - '||numberOfStudents);
END ZRBIDInput;
执行;
SQL> exec ZRBIDInput('1');
2