我是java的新手如果这是一个非常简单的问题,请耐心等待,但我很好奇这个带有{code}的方法调用 - 请参阅下面的代码,以获取方法addSelectionListener中的示例.这样做的目的是什么?我一直在通过文档寻找解释,但似乎无法找到这种做法被称为从不介意任何有用的信息.
setStatusLine.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String message = "I would like to say hello to you.";
if (pressed) {
message = "Thank you for using me";
}
setStatusLine(message);
pressed = !pressed;
}
});
Run Code Online (Sandbox Code Playgroud)
感谢您提供的任何帮助或见解
我正在编写一些oracle存储过程,其中我们有条件逻辑,它影响我们正在使用哪个模式,我不知道如何在sql中为存储过程执行此操作.如果我正在使用预处理语句,那么它很好,但在我只是执行查询以填充另一个变量的情况下,我不知道如何做到这一点.例如
PROCEDURE register (
incustomer_ref in VARCHAR2,
incustomer_type in VARCHAR2,
outreturn_code out VARCHAR2
)
IS
customer_schema varchar2(30);
record_exists number(1);
BEGIN
if incustomer_type='a' then
customer_schema:='schemaA';
elsif incustomer_type='b' then
customer_schema:='schemaB';
end if;
--This type of command I cant get to work
select count(*) into record_exists from **customer_schema**.customer_registration where customer_ref=incustomer_ref
--but a statement like this i know how to do
if record_exists = 0 then
execute immediate 'insert into '||customer_schema||'.customer_registration
values ('||incustomer_ref||','Y',sysdate)';
end if;
Run Code Online (Sandbox Code Playgroud)
谁能照亮我在这里失踪的东西.
干杯
我正在编写一个shell脚本,需要从文本文件中提取值,如下所示:
app.full.name /warfilelocation/ warfilename
Run Code Online (Sandbox Code Playgroud)
我的shell脚本将遍历应用程序名称列表,并使用AWK提取位置或名称.我已使用以下命令在命令行上测试过:awk"\ $ 1~/app.full.name/{print $ 2}"applications.txt
返回我期望的东西然而当我把它放在一个shell脚本中我开始有问题.
我有一个看起来像这样的函数:
function get_location() {
local application=$1
awk "\$1 ~/^$application/ { print \$2 }" applications.txt
}
Run Code Online (Sandbox Code Playgroud)
但是,当我调用此函数时,我收到以下错误:
awk: $1 ~/^app.full.name
awk: ^ unterminated regexp
awk: cmd. line:1: app.full.name
awk: cmd. line:1: ^ syntax error
awk: cmd. line:2: app.full.name/ { print $2 }
awk: cmd. line:2: ^ syntax error
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法我在这里做错了什么.我认为我没有逃避变量的正确,但无论我尝试它似乎都不起作用.
提前致谢