Using a variable plus a plaintext as password
Hi friends
in our AD domain, we have to change the password of all user accounts.
on every user account properties, we have filled the "employee ID" field.
the manager has asked me that the passwords of every user be set in this regulation:
his employee ID end with @aA
i mean at the end of the all passwords, these three characters must be added: @aA
for example imagine employeeID of User1 is '123'
his password must become 123@aA
i tried with the following command but i don't know how to combine the $employeeID variable with this plaintext
@aA string
$OU = 'ou=ou-users,dc=mydomain,dc=lab'
Get-Aduser -filter * -searchbase $OU |
foreach-object {
$EmployeeID = (Get-ADuser -identity $_ -properties *).Description ;
$pass = convertto-SecureString "$emplyeeID" -asplaintext -force# my question is about the above line. i don't know what to write at the location of "$employeeID"# i tested the following but doesn't result as expected ( i know i am not correct): $pass = convertto-SecureString "$emplyeeID"+@aA -asplaintext -force
Set-ADAccountpassword -identity $_ -reset -newpassword $pass
any help please?
A quick look tells me that you need to study how to use strings.
help about_Quoting_Rules
https://technet.microsoft.com/en-us/library/ee692804.aspx?f=255&MSPPError=-2147217396
¯\_(ツ)_/¯
hi jrv. thanks for useful link.
i will study that & will tell the result
Similar Messages
-
Using Bind variables in SQL PLUS Report
using Bind variables in SQL PLUS Report. This report gets the arguments from the application concurrent program. Now my need is to convert the start_date and end_date to bind Variables to improve the performance. I have commented the original code in 'prompt List of Unapproved Adjustments' and used my Bind Variable but it is giving an error
error: Bind Variable "ENDING_DATE" not declared
Report Date and Time:
26-OCT-2010 15:44:13
List of Unapproved Adjustments
Bind Variable 'ENDING_DATE" not declared
Please see below the code for the sql plus report:
define p_org_id = '&1'
define p_fy_begin_date = '&2'
define p_start_date = '&3'
define p_end_date = '&4'
define p_conversion = '&5'
declare
variable begin_date date;
exec :begin_date := p_start_date;
variable ending_date date;
exec :ending_date := p_end_date;
/* Begin
:begin_date := to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS');
:ending_date := to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS');
End; */
set newpage none
set termout off
set pagesize 55
set linesize 180
set heading on
set feedback off
set wrap off
set space 1
set heading on
begin
dbms_application_info.set_client_info('&p_org_id');
end;
prompt
prompt Report Date and Time:
prompt ----------------------
select to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')
from dual ;
prompt
prompt List of Unapproved Adjustments
prompt -------------------------------
select b.trx_number,
a.adjustment_number,
f.user_name created_by
from apps.ar_adjustments a,
apps.ra_customer_trx b,
apps.fnd_user f
where a.customer_trx_id = b.customer_trx_id
and a.status <> 'A'
and a.created_by = f.user_id
and a.creation_date between :begin_date
and :ending_date
-- and a.creation_Date between to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS')
-- and to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS')
order by
b.trx_number ;Hi
Please go to customization part of the report and verify..You have set a default value out there ..And also verify your lov and look at the values ..If it is again giving you the problem ..pl delete the report and develop it again from the scratch it will be solved...
vishnu
null -
Hello,
Below I have posted code that I have on two different PHP files, tsearch12.php and votes12.php. The code works great. The file "tsearch12.php" uses AJAX to go to votes12.php to perform some functions. However, the first page has a variable called "find." These two pages only work together when the variable "find" equals "santafe." I would like them to work together regardless of what "find" equals. In other words, I would like to replace the table name "santafe" in votes12.php with the variable "find," but I want the variable "find" to equal the same value in both tsearch12.php and votes12.php. The variable "find" is going to tsearch12.php from another file, which has a simple HTML form with "<form action="tsearch12.php" method="post">" and "<input type="text" name="find" size="55"/>". Anyway, how do I use the variable "find" in votes12.php?
Thanks in advance,
John
On tsearch12.php, I have:
# <head>
# <script type='text/javascript' src='jquery.pack.js'></script>
# <script type='text/javascript'>
# $(function(){
# $("a.cell1").click(function(){
# //get the id
# the_id = $(this).attr('id');
# // show the spinner
# $(this).parent().html("<img src='images/spinner.gif'/>");
# //fadeout the vote-count
# $("span#votes_count"+the_id).fadeOut("fast");
# //the main ajax request
# $.ajax({
# type: "POST",
# data: "action=vote_up&id="+$(this).attr("id"),
# url: "votes12.php",
# success: function(msg)
# $("span#votes_count"+the_id).html(msg);
# //fadein the vote count
# $("span#votes_count"+the_id).fadeIn();
# //remove the spinner
# $("span#button"+the_id).remove();
# $("a.vote_down").click(function(){
# //get the id
# the_id = $(this).attr('id');
# // show the spinner
# $(this).parent().html("<img src='images/spinner.gif'/>");
# //the main ajax request
# $.ajax({
# type: "POST",
# data: "action=vote_down&id="+$(this).attr("id"),
# url: "votes12.php",
# success: function(msg)
# $("span#votes_count"+the_id).fadeOut();
# $("span#votes_count"+the_id).html(msg);
# $("span#votes_count"+the_id).fadeIn();
# $("span#button"+the_id).remove();
# </script>
# </head>
# <body>
# <?
# //This is only displayed if they have submitted the form
# if ($searching =="yes")
# //If they did not enter a search term we give them an error
# if ($find == "")
# echo "<p>You forgot to enter a search term";
# exit;
# // Otherwise we connect to our Database
# mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
# mysql_select_db("sand2") or die(mysql_error());
# $find = strip_tags($find);
# $find = trim ($find);
# $result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
# or die(mysql_error());
# if(mysql_num_rows($result)>0){
# while($table=mysql_fetch_row($result)){
# print "<p class=\"topic\">$table[0]</p>\n";
# $r=mysql_query("SELECT * FROM `$table[0]`");
# print "<table class=\"navbar\">\n";
# while($row=mysql_fetch_array($r)){
# $effective_vote = $row['votes_up'] - $row['votes_down'];
# print "<tr>";
# print "<td>".'<a href="http://'.$row['site'].'" class="links2">'.$row['site'].'</a>'."</td>";
# print "<td class='votes'>".'<span class="votes_count" id="votes_count'.$row['id'].'">'.number_format($effective_vote).'</span>'."</td>";
# print "<td class='ballot'>".'<span class="button" id="button'.$row['id'].'">'.'<a href="javascript:;" class="cell1" id="'.$row['id'].'">'.Vote.'</a>'.'</span>'."</td>";
# print "</tr>\n";
# print "</table>\n";
# else{
# print "None found";
# $anymatches=mysql_num_rows($result);
# if ($anymatches == 0)
# echo "Sorry, but we can not find an entry to match your query<br><br>";
# ?> On votes12.php, I have:
# <?php
# mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
# mysql_select_db("sand2") or die(mysql_error());
# function getAllVotes($id)
# Returns an array whose first element is votes_up and the second one is votes_down
# $votes = array();
# $q = "SELECT * FROM santafe WHERE id = $id";
# $r = mysql_query($q);
# if(mysql_num_rows($r)==1)//id found in the table
# $row = mysql_fetch_assoc($r);
# $votes[0] = $row['votes_up'];
# $votes[1] = $row['votes_down'];
# return $votes;
# function getEffectiveVotes($id)
# Returns an integer
# $votes = getAllVotes($id);
# $effectiveVote = $votes[0] - $votes[1];
# return $effectiveVote;
# $id = $_POST['id'];
# $action = $_POST['action'];
# //get the current votes
# $cur_votes = getAllVotes($id);
# //ok, now update the votes
# if($action=='vote_up') //voting up
# $votes_up = $cur_votes[0]+1;
# $q = "UPDATE santafe SET votes_up = $votes_up WHERE id = $id";
# elseif($action=='vote_down') //voting down
# $votes_down = $cur_votes[1]+1;
# $q = "UPDATE santafe SET votes_down = $votes_down WHERE id = $id";
# $r = mysql_query($q);
# if($r) //voting done
# $effectiveVote = getEffectiveVotes($id);
# echo $effectiveVote;
# elseif(!$r) //voting failed
# echo "Failed!";
# ?>These forums are for development with Java. Not JavaScript, which is an entirely different language. And AJAX is JavaScript. You need to use Google and find a JavaScript forum for your question (or a PHP forum if your question is really about PHP).
-
How to use a variable in a cursor?
Hi,
Is it possible to use a variable as condition for fetching data using cursors? The code works fine ( as shown) without using the clause 'where empno < 7600'. How can I use the variable 'stmt' in defining/fetching data by using cursor cur_1? My target is to get info for employee whose empno<7600. Any inputs would be appreciated.
DECLARE
STMT VARCHAR2(50) := 'EMPNO < 7600';
CURSOR CUR_1 IS SELECT EMPNO, ENAME, JOB, MGR FROM EMP;
BEGIN
OPEN CUR_1;
LOOP
FETCH CUR_1 INTO :EMP.EMPNO, :EMP.ENAME, :EMP.JOB, :EMP.MGR;
EXIT WHEN CUR_1%NOTFOUND;
NEXT_RECORD;
END LOOP;
CLOSE CUR_1;
END;Hi:
You could use a CURSOR Parameter:
DECLARE
CURSOR CUR_1 (empno_in IN VARCHAR2) IS SELECT EMPNO, ENAME, JOB, MGR FROM EMP WHERE empno < empno_in;
BEGIN
OPEN CUR_1 (7600);
LOOP
FETCH CUR_1 INTO :EMP.EMPNO, :EMP.ENAME, :EMP.JOB, :EMP.MGR;
EXIT WHEN CUR_1%NOTFOUND;
END LOOP;
CLOSE CUR_1;
END;
or a REF Cursor, like so:
DECLARE
TYPE CUR_1_TYPE IS REF CURSOR;
CUR_1 CUR_1_TYPE;
BEGIN
OPEN CUR_1 FOR SELECT EMPNO, ENAME, JOB, MGR FROM EMP WHERE empno < 7600;
LOOP
FETCH CUR_1 INTO :EMP.EMPNO, :EMP.ENAME, :EMP.JOB, :EMP.MGR;
EXIT WHEN CUR_1%NOTFOUND;
END LOOP;
CLOSE CUR_1;
END;
Note - these will run in SQL*Plus ... I believe you are using Oracle Forms as you had the NEXT_RECORD command in your example, and I had to remove it. -
Using the variable placeholder ? in an XPath expression
I'm trying to using the variable operator (?) in an Oracle prepared statement used in a query where clause. Here is the query:
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
where existsNode(E.XML_EVENT_CONTENT, '/xae:auditable-event[xae:event-type=?]','xmlns:xae="http://gov/va/med/datasharing/audit/endpoint/audit"') = 1This code works when the ? is replaced with "aValue". I need to use the ? so that my Java client can pass a variable value into the query.
Is this a supportable feature or am I doing something wrong?
I didn't see any examples in the Oracle XML DB Developers Guide where there was a ? in an XPath expression.
I also tried "?" with the same issue...
Here is the version info:
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 10 18:41:55 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsAny assistance would be greatly appreciated.
Thanks in advance...
Edited by: flyeagle5683 on Sep 10, 2012 5:49 PMselect xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
where XMLEXISTS(
'declarre namespace xae ="http://gov/va/med/datasharing/audit/endpoint/audit"; (: :)
$XML/xae:auditable-event[xae:event-type=$VALUE]'
passing e.xml_event_content as "XML",
:1 as "VALUE"
) or you can do
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
WHERE EVENT_TYPE = :1Edited by: mdrake on Sep 10, 2012 7:23 PM
Edited by: mdrake on Sep 10, 2012 7:24 PM -
Using the variable ? operator in an XPath Expression
I'm trying to using the variable operator (?) in an Oracle prepared statement used in a query where clause. Here is the query:
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
where existsNode(E.XML_EVENT_CONTENT, '/xae:auditable-event[xae:event-type=?]','xmlns:xae="http://gov/va/med/datasharing/audit/endpoint/audit"') = 1This code works when the ? is replaced with "aValue". I need to use the ? so that my Java client can pass a variable value into the query.
Is this a supportable feature or am I doing something wrong?
I didn't see any examples in the Oracle XML DB Developers Guide where there was a ? in an XPath expression.
I also tried "?" with the same issue...
Here is the version info:
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 10 18:41:55 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsAny assistance would be greatly appreciated.
Thanks in advance...I incorporated this suggestion and it worked very well. Thanks!
Now I have converted my solution to use a structured index. As such, I want to write the where clauses in terms of column names rather than XPath expressions.
I hoped it was as simple as changing the code that generates the XPath expression to generate a SQL expression. After making that change, I'm now getting this error:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00920: invalid relational operator
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:686)
at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:617)
at oracle.jdbc.driver.T2CPreparedStatement.executeForDescribe(T2CPreparedStatement.java:559)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1077)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3425)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1490)
at gov.va.med.datasharing.audit.dao.jdbc.runner.MapQueryRunner.run(MapQueryRunner.java:47)
at gov.va.med.datasharing.audit.web.dao.jdbc.AuditableEventsQueryDAOImpl.getAuditableEventsByDate(AuditableEventsQueryDAOImpl.java:150)It seemed to me that if it worked for the XPath expression that it should also work for the SQL expression.
The static SQL is:
SELECT PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID FROM
(SELECT rownum as rn, PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID FROM
(SELECT aet.AUDITABLE_EVENT_XML_PK_ID AS PK_ID, xt.EVENT_TYPE, xt.OUTCOME, xt.SENDING_SITE, xt.RECEIVING_SITE, aet.CREATED_TIME as CREATED_TIME, xt.EVENT_ID, xt.PATIENT_ID
FROM AUDITABLE_EVENT_XML aet,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING aet.xml_event_content
COLUMNS
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:sending-site',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:receiving-site',
EVENT_ID VARCHAR2(255) PATH 'xae:event-id',
PATIENT_ID VARCHAR2(255) PATH 'xae:patient-id',
OUTCOME VARCHAR2(255) PATH 'xae:outcome') xt
WHERE aet.CREATED_TIME BETWEEN ? AND ?
AND ?
) ORDER BY CREATED_TIME desc
) WHERE rn > ? and rn <= ?So I'm thinking that Oracle must perform strong checking in SQL, not allowing the '=' operator to be substituted. If I run this query in Toad, replacing the ? with the SQL, it runs fine...
Can someone tell me whether or not this is a legal substitution?
The SQL that runs in Toad is:
SELECT PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID FROM
(SELECT rownum as rn, PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID FROM
(SELECT aet.AUDITABLE_EVENT_XML_PK_ID AS PK_ID, xt.EVENT_TYPE, xt.OUTCOME, xt.SENDING_SITE, xt.RECEIVING_SITE, aet.CREATED_TIME as CREATED_TIME, xt.EVENT_ID, xt.PATIENT_ID
FROM AUDITABLE_EVENT_XML aet,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING aet.xml_event_content
COLUMNS
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:sending-site',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:receiving-site',
EVENT_ID VARCHAR2(255) PATH 'xae:event-id',
PATIENT_ID VARCHAR2(255) PATH 'xae:patient-id',
OUTCOME VARCHAR2(255) PATH 'xae:outcome') xt
WHERE aet.CREATED_TIME BETWEEN TO_DATE ('9/19/2011 12:00:01 AM','MM/DD/YYYY HH:MI:SS PM')
AND TO_DATE ('12/20/2012 12:00:00 AM','MM/DD/YYYY HH:MI:SS PM')
AND (OUTCOME=0 or OUTCOME=1)
) ORDER BY CREATED_TIME desc
) WHERE rn > 0 and rn <= 5;Any assistance will be appreciated,
Thanks in advance. -
Good day to all,
I have a question related to VB.
Is there any way to use Bind variables in VB, or any other way, that my same query will not parse every time in Oracle just for a little difference in variable field..
Regards
AnsYou'd use OracleParameters. I dont do VB.NET, but here's a c# example you should be able to easily convert.
Hope it helps,
Greg
using (OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl"))
con.Open();
using (OracleCommand cmd = new OracleCommand("", con))
cmd.CommandText = "insert into emp (empno, ename) values (:e1, :e2)";
cmd.Parameters.Add(new OracleParameter("e1",OracleDbType.Int32,0,1234,ParameterDirection.Input));
cmd.Parameters.Add(new OracleParameter("e2",OracleDbType.Varchar2,4,"KING",ParameterDirection.Input));
cmd.ExecuteNonQuery();
Console.WriteLine("done");
} -
Using environment variables in RMAN command line
I'm running Oracle 11gR2 and working in a Solaris 10 environment.
I am trying to run the rman command by connecting to the target, auxiliary, and catalog by catting out the contents of password files where I have my connect strings stored for each database. Also in there I am trying to use environment variables to reference each database.
rman target "`cat ${HOME}/password_dir/prod_connect.txt`@${PROD_DB}" auxiliary "`cat ${HOME}/password_dir/stage_connect.txt`@`${STAGE_DB}`" catalog "`cat ${HOME}/password_dir/rman_catalog_connect.txt`@${RMAN_CATALOG_DB}"
The end result I need is:
rman target "username/password@db" auxiliary "username/password@db" catalog "username/password@db"
Is this possible?Levi,
Good idea on the variables. I set up a variable with my connect string including the TNS reference (i.e. user/password@XXX)
So when I run this:
rman auxiliary ${AUXILIARY}
I get this:
Recovery Manager: Release 11.2.0.2.0 - Production on Wed Jun 13 10:19:44 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges
But if I try to run it without the TNS entry it works. The only issue with that is I need the TNS reference to connect to the database I'm cloning from. Any idea what's going on here?
Also, the same applies to the TARGET, but oddly enough not the CATALOG. It will connect to my rman catalog using the TNS just fine. The only difference is with the catalog I'm logging in as my rman catalog user. With the TARGET and AUXILIARY I'm logging in as the system user.
Edited by: Nevin on Jun 13, 2012 8:25 AM -
Session variable using :GROUP variable in init block
I'd like to filter using session variable.
This session variaible should be build using :GROUP special session variable
I'd like do something like this (init block):
select case when instr(upper(':GROUP'), 'ADMINISTRATOR')>0 then 'Yes' else 'No' end from dual
but it seems to doesn't work properly (It means I have always 'No' value)
After investigation i did some simple test
initialization block like this:
select upper(':USER'),upper(':GROUP') from dual
set variables using above init block: UPP_USER and UPP_GROUP
next i did simple reques with 4 columns:
*1. VALUEOF(NQ_SESSION.USER)*
*2. VALUEOF(NQ_SESSION.GROUP)*
*3. VALUEOF(NQ_SESSION.UPP_USER)*
*4. VALUEOF(NQ_SESSION.UPP_GROUP)*
and my result is:
1. Administrator
2. Administrators;IT_Deparment ....
3. ADMINISTRATOR
4. _:GROUP_
Why in 4th column I didn't get: ADMINISTRATOR;IT_DEPARTMENTS ....
Can I use special variable GROUP in initialization block?
Could someone explain it?Hi,
Only :USER and :PASSWORD are available
try (select 'VALUEOF(NQ_SESSION.USER)', 'VALUEOF(NQ_SESSION.GROUP)' from dual instead.
(You migth have to force a fill of the group variable first)
Regards
John
http://obiee101.blogspot.com/ -
How to set MULTIPLE repository variables using presentation variables
Hi,
I need to pass multiple values from presentation variable to repository.
A brief about report design :
I have two repository variables - from_dt and to_dt which are defaulted to some values from a database table and are editable by the user.
I display these default date values on the dashboard. Plus there are two dashboard date prompts allowing user to enter a date range different from what is displayed by the from_dt and to_dt. The dates entered by user are assigned to presentation variables pv_from_dt and pv_to_dt.
If user specifies a different date range then these date values are to be passed to a stored procedure which is called from the Connection Pool --> Connection Script Tab --> Execute before query. This procedure will do some calculations and populate a global temporary table before running the report.
Problem :
Now in the presentation server, in the Advanced tab, in the Prefix section, when i try to write something like this:
SET VARIABLE from_dt = '@{pv_from_dt}';
SET VARIABLE to_dt = '@{pv_to_dt}';
I get the foll error :-
Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Odbc driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <SET>: Syntax error [nQSError: 26012] . (HY000)
I tried all possible permutations and combinations
SET VARIABLE from_dt = '@{pv_from_dt}',SET VARIABLE to_dt = '@{pv_to_dt}'; --- gave same error
SET VARIABLE from_dt = '@{pv_from_dt}' SET VARIABLE to_dt = '@{pv_to_dt}'; -- gave same error
How do we assign values to multiple reporsitory variables... ???
Thanks
NusratHi,
I wrongly referred to the variables as "repository" variables. Both variables are Session variables. For testing i added a column field in the report with source as the session variable - VALUEOF(NQ_SESSION.from_dt). In the Prefix section i assigned a literal value - SET VARIABLE from_dt='01-JAN-2012';
When report is run, the literal value gets displayed.
The idea to update a session variable, from dashboard using presentation variable, i got from the following URL.
Go to http://oraclebizint.wordpress.com/category/obi-ee-plus/page/11/
and see the section "Oracle BI EE 10.1.3.3/2 – Updating Session Variables from Dashboards using Presentation Variables"
Thanks
Nusrat
Edited by: user10309945 on Jan 16, 2011 9:30 PM
Edited by: user10309945 on Jan 16, 2011 9:59 PM -
Simple use of variables in query
Hi,
i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
I could use:
SELECT * FROM TABLE
where TRADE_DATE = '2010-10-23'
but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
declare @trade_date datetime
set @trade_date = '2010-10-23'
SELECT * FROM TABLE
where TRADE_DATE = @trade_date
Could someone help me and write the last query using PL/SQL syntax?
Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.There are a couple of differences besides variable syntax. The variable would look like this in PL/SQL:
declare
v_trade_date date := DATE '2010-10-23';
begin
select * into ????? -- see below
from table
where trade_date = v_trade_date;
end;However the next difference is that PL/SQL does not implicitly return result sets to the client application, so you either have to select <b>into</b> a PL/SQL variable, or process the values in a loop, or explicitly return a ref cursor (or just do the processing in SQL statements within the procedure, without returning anything). I don't know much about T-SQL but I have the impression that in Oracle there is a stronger distinction between SQL (the interpreted query language) and PL/SQL (the compiled programming language) than the equivalents in SQL Server. Saubhik's example above is not PL/SQL (which you asked about) but plain SQL.
Using the example of SQL*Plus, you might use a ref cursor like this:
var r refcursor;
declare
v_trade_date date := DATE '2010-10-23';
begin
open :r for
select *
from test_table
where trade_date = v_trade_date;
end;
print :ror
var r refcursor;
create or replace procedure p (p_out_results out sys_refcursor)
as
v_trade_date date := DATE '2010-10-23';
begin
open p_out_results for
select *
from test_table
where trade_date = v_trade_date;
end p;
set autoprint on
exec p(:r)Edited by: William Robertson on Oct 24, 2010 5:31 PM -
Mitigating SQL injection when forced to use substitution variables
The 3rd party software that I use has exactly one way of allowing users to specify runtime parameters: Substitution variables.
The scripts are executed using SQL*Plus. I'm looking for ways to secure this.
Please don't say "Don't use substitution variables" - read above, it's the only way this software works.
My first thought was something like this:
var myvar varchar2(30)
exec :myvar := '&user_input';That's no good. What if the user specifies "X'; execute immediate 'drop table sometable" Then we get
exec :myvar := 'X'; execute immediate 'drop table sometable';Again, no good.
I thought perhaps something like the following would work:
exec :myvar := dbms_assert.noop('&user_input');but then again, a malicious user could specify "'); execute immediate 'drop table sometable'; dbms_assert.noop('"
I'm open to suggestions.
What can I do to sanitize substitution variables?
Thank you!
Edited by: krissco on Jan 30, 2013 3:02 PMYou could use:
var myvar varchar2(30)
exec :myvar := DBMS_ASSERT.ENQUOTE_LITERAL('&user_input');For example:
SQL> exec :myvar := '&user_input';
Enter value for user_input: X';execute immediate 'begin dbms_output.put_line(''XXXX'');end;
XXXX
PL/SQL procedure successfully completed.
SQL> exec :myvar := DBMS_ASSERT.ENQUOTE_LITERAL('&user_input');
Enter value for user_input: X';execute immediate 'begin dbms_output.put_line(''XXXX'');end;
BEGIN :myvar := DBMS_ASSERT.ENQUOTE_LITERAL('X';execute immediate 'begin dbms_output.put_line(''XXXX'');end;'); END;
ERROR at line 1:
ORA-06550: line 1, column 48:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
) , * & = - + < / > at in is mod remainder not rem =>
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec as between from using || multiset member
submultiset
The symbol ")" was substituted for ";" to continue.
ORA-06550: line 1, column 110:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem return
returning <an exponent (**)> <> or != or ~= >= <= <> and or
like like2 like4 likec between into
SQL>SY.
Edited by: Solomon Yakobson on Jan 30, 2013 8:28 PM -
Is is better to use static variables?
Hi,
Does anyone know if it's better to use static variables or to use normal variables?
Concerning the size of the code, it seems that declaring a variable as static is more consuming (for example plus 6 bytes for an object reference).
So this could mean that declaring variables as static should be avoided, but what about the execution time?
Some years ago, some javacard gurus were claiming that it's was better to use static variables (less processing required by the JVM to resolve adresses of static variables), but is it still the case?Hi Lexdabear,
Thanks for the answer.
I did the test (I converted my all code to use static variables and methods as much as possible), and did a bench before and after, on a JCOP31 card.
The conclusion is that today JVMs and processors are much powerful than 5 years ago, and that the difference is really difficult to measure, which anyway is a good thing for us ;-) -
Switching browser using IE tab plus - the Norton Identity Safe does not work
Using Firefox 4.0.1 and Norton 360 5.1.0.29 - which has recently been "fixed" to work together (by Norton).
When using IE Tab Plus to switch rendering engines (Firefox to IE) the Norton Identity Safe does not work by not pre filling user names and passwords to sites that are registered in the Norton Safe and also for any new sites does not offer the option to add a new site to the Norton safe . . . . . is this a Norton or Firefox or IE Tab issue? And has anyone else had this problem?Symantec need to update their Firefox add-ons so that they are compatible with Firefox 4. They have indicated that for Norton 360 they plan to release an update to Norton 360 to support Firefox 4 in early May - http://us.norton.com/support/kb/web_view.jsp?wv_type=public_web&docurl=20100720113635EN&ln=en_US
I do not know about the time scale for updates for other Norton products. Pending the update by Symantec, if you want to use the Norton add-ons you will need to downgrade to Firefox 3.6.
To downgrade to Firefox 3.6 first uninstall Firefox 4, but do not select the option to "Remove my Firefox personal data". If you select that option it will delete your bookmarks, passwords and other user data.
You can then install the latest version of Firefox 3.6 available from http://www.mozilla.com/en-US/firefox/all-older.html - it will automatically use your current bookmarks, passwords etc.
To avoid possible problems with downgrading, I recommend going to your profile folder and deleting the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Deleting these files will force Firefox to rebuild the list of installed extensions, checking their compatibility, and reset toolbar customizations.
For details of how to find your profile folder see https://support.mozilla.com/kb/Profiles -
Why can't kids under 13 use the nike plus website?
Does anyone know why kids under the age of 13 can't use the Nike plus website.
Same reason you must be at least 13 on most websites.
https://nikerunning.custhelp.com/cgi-bin/nikerunning.cfg/php/enduser/stdadp.php?p_faqid=3522&psid=Dqm2d*nj
"Registration
To post some User Generated Content, you must become a registered user ("Registrant"). Registrants must create a user ID and password. You must be at least 13 years of age to become a Registrant. If you are between 13 and 18 years old, you must have your parent/guardian's permission to use or post User Generated Content."
http://discussions.apple.com/help.jspa
"Minors
You must be at least 13 years old to post to the Site. If you are over 13 years old but have not yet reached the age of majority, you must have your parent or guardian’s permissions to post to the Site."
Maybe you are looking for
-
Clearing Down payments through F-58
Hi SAP Gurus, My client has made a down payment of 90% to a vendor by F-48. He wishes to clear the same and pay the remaining amount by using F-58. In F-58 when Spl GL Indicator is given as "A" the down payment is appearing and in simulation also it
-
I am unable to sign-in to the Password Books App after installing IOS 7 and the app is no longer in iTunes , published by Razor Apps, LLC, have all my passwords in this app.
-
Need to install NW 7.0 BW component with EHP1
Dear All, We are in need to install BW component 7.0 with EHP1 SR1 and we are using the installation master "51036888_13". I can able to see 1. SAP process integration 2. SAP Mobile Infrastructure
-
HT5312 Is there a reason I can't fill anything out on a mobile phone?
I'm trying I reset my security questions, because I made them a long time ago and they seem to have left me! Please help.
-
My iphone 6 turned off while i was using face time and it returns with the screen saying Hello mean its reset automatically how is this possible ? Now it requires an id and password to activate which i do not remember need help ? but i do remember th