One column having multiple values with comma separator.
Hey Guys,
In my db, one culmn having multiple values with comma separator. like column_name = 'value1,value2,value3'. Now I want to compare this column to another column and fetch in Cursor.
and each value having corresponding email_id, By fetching cursor, I need to populate email_ids.
Thanks in advance!!
-Lakshman
Please compare and fetch cursor and populate result with out extract data into temp table. Give me the query!You have not provided DDL for table so I don't know table or column name to write any SQL.
You have not provided DML for test data to run SQL against.
Similar Messages
-
Displaying Amount value with comma separation
Hi ,
There are some amount fields in the page
displaying in the format Amount 1000000.00
Required to display in the format 1,000,000.00
Is there any profile to set like this or we have to do anything by personalization.
Regards,
Krishna.Hello Krishna,
Were you ever successful in finding a fix for this? We have a similar requirement, but I'm not seeing anything where this can be done, either via personalizations or the Property Inspector in java.
One question I do have though, is if we do turn this on for our number values, and we have an Export to Excel function, is that going to cause the data to get improperly separated when the Export to Excel function is invoked?
Thanks,
Janel -
Adding a parameter with comma separated having different values
i want to add a parameter with comma separated having different values of a column. e.g i have column having values from 10000 to 99999. i want to create report for the selected values of 11111,12111,131111 etc. This selection can be one or more values as desired. Second problem is restricting the records as per parameter.
Reports doesn't allow multi-selection of a parameter in its parameter form. You need to use Oracle*Forms or an HTML Form to front end more advanced parameter form options.
However, you could have multiple parameters and combine their selections into a single parameter in the after parameter form trigger. This would at least allow you to give the user the option for selecting up to 'n' parameters. The single parameter would have to be of type "character" and you probably want to add appropriate quotes around the values in the after parameter form trigger.
Second problem is restricting the records as per parameter. Once you've got the comma seperated values into a single parameter (say p_myValues with a default value of '') then you can just use a lexical parameter to restrict the values as in:
select * from emp
where to_char(empno) in (&p_myValues) -
SQL - Multiple Fetch into Single Column with Comma Separator
Hello Experts,
Good Day to all...
I need your help on following scenarios. The below query returns set of titleID strings. Instead of printing them one below the other as query output, I want the output to be in batch of 25 values.i.e each row should have 25 values separated by comma. i.e If there are 100 titles satisfying the output, then there should be only four rows with and each row having 25 titles in comma separated manner.
SELECT DISTINCT title_id
FROM pack_relation
WHERE package_id IN ( SELECT DISTINCT fa.package_id
FROM annotation fa
GROUP BY fa.package_id
HAVING COUNT
(fa.package_id) <100);I tried with the PL/SQL block; whereas it is printing all the values continously :(
I need to stop with 25 values and display.
If its possible with SQL block alone; then it would be of great help
DECLARE
v_str VARCHAR2 (32767) := NULL;
CURSOR c1
IS
SELECT DISTINCT title_id
FROM pack_relation
WHERE package_id IN ( SELECT DISTINCT fa.package_id
FROM annotation fa
GROUP BY fa.package_id
HAVING COUNT
(fa.package_id) <100);
BEGIN
FOR i IN c1
LOOP
v_str := v_str || ',' || i.title_id;
END LOOP;
v_str := SUBSTR (v_str, 2);
DBMS_OUTPUT.put_line (v_str);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error-->' || SQLERRM);
END;Thanks...You can use CEIL
Sample code
SELECT
nt,
LTRIM(MAX(SYS_CONNECT_BY_PATH(val,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val
FROM
SELECT
val,
nt,
ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val) AS curr,
ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val) -1 AS prev
FROM
SELECT
level AS val,
ceil(rownum/3) as nt /* Grouped in batches of 3 */
FROM
dual
CONNECT BY level <= 10
GROUP BY
nt
CONNECT BY prev = PRIOR curr
AND nt = PRIOR nt
START WITH curr = 1;
NT CONCAT_VAL
1 1,2,3
2 4,5,6
3 7,8,9
4 10Your code
SELECT
nt,
LTRIM(MAX(SYS_CONNECT_BY_PATH(title_id,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val
FROM
SELECT
title_id,
nt,
ROW_NUMBER () OVER (PARTITion BY nt ORDER BY title_id) AS curr,
ROW_NUMBER() OVER (PARTITION BY nt ORDER BY title_id) -1 AS prev
FROM
SELECT
title_id,
ceil(rownum/25) AS nt /* Grouped in batches of 25 */
FROM
pack_relation tdpr
JOIN annotation fa
ON
tdpr.package_id = fa.package_id
GROUP BY
title_id,
fa.package_id
HAVING
COUNT (fa.package_id) < 500
GROUP BY
nt
CONNECT BY prev = PRIOR curr
AND nt = PRIOR nt
START WITH curr = 1; -
How can i get all these values in single row with comma separated?
I have a table "abxx" with column "absg" Number(3)
which is having following rows
absg
1
3
56
232
43
436
23
677
545
367
xxxxxx No of rows
How can i get all these values in single row with comma separated?
Like
output_absg
1,3,56,232,43,436,23,677,545,367,..,..,...............
Can you send the query Plz!These all will do the same
create or replace type string_agg_type as object
2 (
3 total varchar2(4000),
4
5 static function
6 ODCIAggregateInitialize(sctx IN OUT string_agg_type )
7 return number,
8
9 member function
10 ODCIAggregateIterate(self IN OUT string_agg_type ,
11 value IN varchar2 )
12 return number,
13
14 member function
15 ODCIAggregateTerminate(self IN string_agg_type,
16 returnValue OUT varchar2,
17 flags IN number)
18 return number,
19
20 member function
21 ODCIAggregateMerge(self IN OUT string_agg_type,
22 ctx2 IN string_agg_type)
23 return number
24 );
25 /
create or replace type body string_agg_type
2 is
3
4 static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
5 return number
6 is
7 begin
8 sctx := string_agg_type( null );
9 return ODCIConst.Success;
10 end;
11
12 member function ODCIAggregateIterate(self IN OUT string_agg_type,
13 value IN varchar2 )
14 return number
15 is
16 begin
17 self.total := self.total || ',' || value;
18 return ODCIConst.Success;
19 end;
20
21 member function ODCIAggregateTerminate(self IN string_agg_type,
22 returnValue OUT varchar2,
23 flags IN number)
24 return number
25 is
26 begin
27 returnValue := ltrim(self.total,',');
28 return ODCIConst.Success;
29 end;
30
31 member function ODCIAggregateMerge(self IN OUT string_agg_type,
32 ctx2 IN string_agg_type)
33 return number
34 is
35 begin
36 self.total := self.total || ctx2.total;
37 return ODCIConst.Success;
38 end;
39
40
41 end;
42 /
Type body created.
[email protected]>
[email protected]> CREATE or replace
2 FUNCTION stragg(input varchar2 )
3 RETURN varchar2
4 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
5 /
CREATE OR REPLACE FUNCTION get_employees (p_deptno in emp.deptno%TYPE)
RETURN VARCHAR2
IS
l_text VARCHAR2(32767) := NULL;
BEGIN
FOR cur_rec IN (SELECT ename FROM emp WHERE deptno = p_deptno) LOOP
l_text := l_text || ',' || cur_rec.ename;
END LOOP;
RETURN LTRIM(l_text, ',');
END;
SHOW ERRORS
The function can then be incorporated into a query as follows.
COLUMN employees FORMAT A50
SELECT deptno,
get_employees(deptno) AS employees
FROM emp
GROUP by deptno;
###########################################3
SELECT SUBSTR(STR,2) FROM
(SELECT SYS_CONNECT_BY_PATH(n,',')
STR ,LENGTH(SYS_CONNECT_BY_PATH(n,',')) LN
FROM
SELECT N,rownum rn from t )
CONNECT BY rn = PRIOR RN+1
ORDER BY LN desc )
WHERE ROWNUM=1
declare
str varchar2(32767);
begin
for i in (select sal from emp) loop
str:= str || i.sal ||',' ;
end loop;
dbms_output.put_line(str);
end;
COLUMN employees FORMAT A50
SELECT e.deptno,
get_employees(e.deptno) AS employees
FROM (SELECT DISTINCT deptno
FROM emp) e;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE FUNCTION concatenate_list (p_cursor IN SYS_REFCURSOR)
RETURN VARCHAR2
IS
l_return VARCHAR2(32767);
l_temp VARCHAR2(32767);
BEGIN
LOOP
FETCH p_cursor
INTO l_temp;
EXIT WHEN p_cursor%NOTFOUND;
l_return := l_return || ',' || l_temp;
END LOOP;
RETURN LTRIM(l_return, ',');
END;
COLUMN employees FORMAT A50
SELECT e1.deptno,
concatenate_list(CURSOR(SELECT e2.ename FROM emp e2 WHERE e2.deptno = e1.deptno)) employees
FROM emp e1
GROUP BY e1.deptno;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE TYPE t_string_agg AS OBJECT
g_string VARCHAR2(32767),
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER
SHOW ERRORS
CREATE OR REPLACE TYPE BODY t_string_agg IS
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER IS
BEGIN
sctx := t_string_agg(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER IS
BEGIN
SELF.g_string := self.g_string || ',' || value;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER IS
BEGIN
returnValue := RTRIM(LTRIM(SELF.g_string, ','), ',');
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER IS
BEGIN
SELF.g_string := SELF.g_string || ',' || ctx2.g_string;
RETURN ODCIConst.Success;
END;
END;
SHOW ERRORS
CREATE OR REPLACE FUNCTION string_agg (p_input VARCHAR2)
RETURN VARCHAR2
PARALLEL_ENABLE AGGREGATE USING t_string_agg;
/ -
Having multiple problems with script - NTFS Permissions and AD Groups
Hi, all! I'm having multiple problems with my first script I've written with Powershell. The script below does the following:
1. Prompts the user for a corporate division under which a shared folder will be created, and adjusts variables accordingly.
2. Prompts if the folder will be a global folder or an office/location-specific folder, and makes appropriate adjustments to variables.
3. If a global folder, prompts for the name. If an office/location-specific folder, prompts for each component of the street address, city and state and an optional modifier. I've prompted for this information in this way because the information
is used differently later on in the script.
4. Verifies the entered information and requests confirmation to proceed.
5. Creates the folder.
6. Creates an AD OU and/or security group(s).
7. Applies appropriate security groups to the new folder and removes undesired permissions.
Import-Module ActiveDirectory
$Division = ""
$DivAbbr = ""
$OU = ""
$OUDrive = "AD:\"
$FolderName = ""
$OUName = ""
$GroupName = ""
$OURoot = "ou=DFS Restructure Testing OU,ou=Pennsylvania Camp Hill 4410 Industrial Park Rd,ou=Locations,ou=Camp Hill,dc=jacobsonco,DC=com"
$FSRoot = "E:\"
$FolderPath = ""
$DefaultFolders = "Archive","Customer Service","Equipment","Inbounds","Management","Outbounds","Processes","Projects","Quality","Reports","Returns","Safety","Schedules","Time Keeping","Training"
[bool]$Location = 0
do {
$userInput = Read-Host "Enter CLS Division: (W)arehousing, (S)taffing, or (P)ackaging"
Switch ($userInput)
W {$Division = "Warehousing"; $DivAbbr = "WHSE"; $OU = "ou=Warehousing,"; break}
S {"Staffing is not yet implemented."; break}
P {"Packaging is not yet implemented."; break}
default {"Invalid choice. Please re-enter."; break}
while ($DivAbbr -eq "")
write-host ""
write-host ($Division + " was selected.")
$FolderPath = $Division + "\"
write-host ""
$choice = ""
do {
$choice = Read-Host "Will this be a (G)lobal folder or (L)ocation folder?"
Switch ($choice)
G {$Location = $false; break}
L {$Location = $true; $FolderPath = $FolderPath + "Locations\"; $OU = "ou=Locations," + $OU; break}
default {"Invalid choice. Please re-enter."; $choice = ""; break}
while ($choice -eq "")
write-host ""
write-host ("Location is set to: " + $Location)
write-host ""
if ($Location -eq $false) {
$FolderName = Read-Host "Please enter folder name:"
$GroupName = $DivAbbr + " " + $FolderName
} else {
$input = Read-Host "Please enter two-letter state abbreviation:"
$FolderName = $FolderName + $input + " "
$input = Read-Host "Please enter city:"
$FolderName = $FolderName + $input + " "
$input = Read-Host "Please enter street address number only:"
$FolderName = $FolderName + $input
$GroupName = $DivAbbr + " " + $FolderName
$FolderName = $FolderName + " "
$input = Read-Host "Please enter street name:"
$FolderName = $FolderName + $input
$input = Read-Host "Please enter any optional information to appear in folder name:"
if ($input -ne "") {
$FolderName = $FolderName + " " + $input
$OUName = $FolderName
write-host
write-host "Path for folder: "$FSRoot$FolderPath$FolderName
write-host "AD Path: "$OUDrive$OU$OURoot
write-host "New OU Name: "$OUName
write-host -NoNewLine "New Security Group names: "$GroupName
if ($Location -eq $true) { write-host " and "$GroupName" MGMT" }
write-host
$input = Read-Host "Please confirm creation of new site/folder: (Y/N) "
if ($input -ne "Y") { Exit }
write-host
write-host -NoNewLine "Folder exists: "; Test-Path ($FSRoot + $FolderPath + $FolderName)
if (Test-Path ($FSRoot + $FolderPath + $FolderName)) {
Write-Host "Folder already exists! Skipping folder creation..."
} else {
write-host "Folder does not exist. Creating..."
new-item -path ($FSRoot + $FolderPath) -name $FolderName -itemtype directory
Set-Location ($FSRoot + $FolderPath + $FolderName)
if ($Location -eq $true) {
$tempOUName = "ou=" + $OUName + ","
write-host
write-host $OUDrive$tempOUName$OU$OURoot
write-host
write-host -NoNewLine "OU exists: "; Test-Path ($OUDrive + $tempOUName + $OU + $OURoot)
if (Test-Path ($OUDrive + $tempOUName + $OU + $OURoot)) {
Write-Host "OU already exists! Skipping OU creation..."
} else {
write-host "OU does not exist. Creating..."
New-ADOrganizationalUnit -Name $OUName -Path ($OU + $OURoot) -ProtectedFromAccidentalDeletion $false
$GroupNameMGMT = $GroupName + " MGMT"
if (!(Test-Path ($OUDrive + "CN=" + $GroupName + "," + $tempOUName + $OU + $OURoot))) { write-host "Normal user group does not exist. Creating..."; New-ADGroup -Name $GroupName -GroupCategory Security -GroupScope Global -Path ("OU=" + $OUName + "," + $OU + $OURoot)}
if (!(Test-Path ($OUDrive + "CN=" + $GroupNameMGMT + "," + $tempOUName + $OU + $OURoot))) { write-host "Management user group does not exist. Creating..."; New-ADGroup -Name $GroupNameMGMT -GroupCategory Security -GroupScope Global -Path ("OU=" + $OUName + "," + $OU + $OURoot)}
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
$FolderACL.SetAccessRuleProtection($True,$True)
# $FolderACL.Access | where {$_.IdentityReference -eq "BUILTIN\Users"} | %{$FolderACL.RemoveAccessRuleAll($_)}
$BIUsers = New-Object System.Security.Principal.NTAccount("BUILTIN\Users")
$BIUsersSID = $BIUsers.Translate([System.Security.Principal.SecurityIdentifier])
write-host $BIUsersSID.Value
# out-string -inputObject $BIUsers
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($BIUsersSID.Value,"ReadAndExecute,AppendData,CreateFiles,Synchronize","ContainerInherit, ObjectInherit", "None", "Allow")
$FolderACL.RemoveAccessRuleAll($Ar)
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
get-acl ($FSRoot + $FolderPath + $FolderName) | fl
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
$ADGroupName = "JACOBSON\" + $GroupName
$objUser = New-Object System.Security.Principal.NTAccount($ADGroupName)
$objUser.Translate([System.Security.Principal.SecurityIdentifier]).Value
write-host $ADGroupName
write-host $objUser.Value
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($ADGroupName,"ReadAndExecute","ContainerInherit, ObjectInherit", "None", "Allow")
Out-String -InputObject $ar
$FolderACL.AddAccessRule($Ar)
$ADGroupName = "JACOBSON\" + $GroupNameMGMT
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($ADGroupName, "Modify", "ContainerInherit, ObjectInherit", "None", "Allow")
Out-String -InputObject $ar
$FolderACL.AddAccessRule($Ar)
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
} else {
$tempOUName = "cn=" + $GroupName + ","
write-host
write-host $OUDrive$tempOUName$OU$OURoot
write-host
write-host -NoNewLine "Group exists: "; Test-Path ($OUDrive + $tempOUName + $OU + $OURoot)
if (Test-Path ($OUDrive + $tempOUName + $OU + $OURoot)) {
Write-Host "Security group already exists! Skipping new security group creation..."
} else {
write-host "Security group does not exist. Creating..."
New-ADGroup -Name $GroupName -GroupCategory Security -GroupScope Global -Path ($OU + $OURoot)
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
$ADGroupName = "JACOBSON\" + $GroupName
$FolderACL.SetAccessRuleProtection($True,$True)
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($ADGroupName,"Modify","ContainerInherit, ObjectInherit", "None", "Allow")
$FolderACL.AddAccessRule($Ar)
$FolderACL.Access | where {$_.IdentityReference -eq "BUILTIN\Users"} | %{$FolderACL.RemoveAccessRuleAll($_)}
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
My problems right now are in the assignment/removal of security groups on the newly-created folder, and the problems are two-fold. Yes, I am running this script as an Administrator.
First, I am unable to remove the BUILTIN\Users group from the folder when this is an office/location-specific folder. I've tried to remove the group in several different ways, and none are having any effect. Oddly, if I type in the lines directly
into Powershell, they work as expected. I've tried the following methods:
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
$FolderACL.SetAccessRuleProtection($True,$True)
$FolderACL.Access | where {$_.IdentityReference -eq "BUILTIN\Users"} | %{$FolderACL.RemoveAccessRuleAll($_)}
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
$FolderACL.SetAccessRuleProtection($True,$True)
$BIUsers = New-Object System.Security.Principal.NTAccount("BUILTIN\Users")
$BIUsersSID = $BIUsers.Translate([System.Security.Principal.SecurityIdentifier])
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($BIUsersSID.Value,"ReadAndExecute,AppendData,CreateFiles,Synchronize","ContainerInherit, ObjectInherit", "None", "Allow")
$FolderACL.RemoveAccessRuleAll($Ar)
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
In the first case, the script goes through and has no apparent effect because afterwards, I do a get-acl and the BUILTIN\Users group is still there, although when looking through the GUI, inheritance appears to have been broken from the parent folder.
In the second case, I get the following error message:
Exception calling "RemoveAccessRuleAll" with "1" argument(s): "Some or all identity references could not be translated."
At C:\Users\tesdallb\Documents\FileServerBuild.ps1:110 char:5
+ $FolderACL.RemoveAccessRuleAll($Ar)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IdentityNotMappedException
This seems strange that the local server is unable to translate the SID of a BUILTIN account. I've also tried explicitly putting in the BUILTIN\Users SID in place of the variable in the New-Object line, but that gives me the same error. I've
also tried the solutions given in this thread:
http://social.technet.microsoft.com/Forums/windowsserver/en-US/ad59dc58-1360-4652-ae09-2cd4273cbd4f/remove-acl-issue?forum=winserverpowershell and at this URL:
http://technet.microsoft.com/en-us/library/ff730951.aspx but these solutions also failed to have any effect.
My second problem is when I try to apply the newly-created security groups, I also will get the "Some or all identity references could not be translated." I thought I had found a workaround to the problem by adding the -PassThru option to
the New-ADGroup commands, because it would output the SID of the group after creation, however a few lines later, the server is unable to translate the account to apply the security groups to the folder.
My first Powershell script has been working well up to this point and now I seem to have hit a showstopper. Any help is appreciated.
Thanks!I was hoping to stay with strictly Powershell, but unless I can find a Powershell solution, I may resort to ICACLS.
As for the problems with my groups not being translatable right after creating them, I think I have solved this problem by using the -Server parameter on all my New-ADGroup commands and this example code seems to have gotten around the translation problem,
again utilizing the -Server parameter on the Get-ADGroup command:
get-acl ($FSRoot + $FolderPath + $FolderName) | fl
$FolderACL = get-acl ($FSRoot + $FolderPath + $FolderName)
# Add the new normal users group to the folder with Read and Execute permissions
$GroupSID = Get-ADGroup -Identity $GroupName -Server chadc01.jacobsonco.com | Select-Object -ExpandProperty SID
$SIDIdentity = New-Object System.Security.Principal.SecurityIdentifier($GroupSID)
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($SIDIdentity,"ReadAndExecute","ContainerInherit, ObjectInherit", "None", "Allow")
$FolderACL.AddAccessRule($Ar)
# Add the management users group to the folder with Modify permissions
$GroupMGMTSID = Get-ADGroup -Identity $GroupNameMGMT -Server chadc01.jacobsonco.com | Select-Object -ExpandProperty SID
$SIDIdentity = New-Object System.Security.Principal.SecurityIdentifier($GroupMGMTSID)
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($SIDIdentity, "Modify", "ContainerInherit, ObjectInherit", "None", "Allow")
$FolderACL.AddAccessRule($Ar)
Set-ACL ($FSRoot + $FolderPath + $FolderName) $FolderACL
Going this route seems to ensure that the Domain Controller I'm creating my groups on is the same one that I'm querying for the group's SID to use in the FileSystemAccessRule. It's been working fairly consistently.
Still having issues with the translation of the BUILTIN\Users group, though. -
Hi all ,
I have a currency filed TFULLVACWTG. I am summing all values like this
TFULLVACWTG = VFWTG001 + VFWTG002 + VFWTG003 + VFWTG004 + VFWTG005 . iam getting output like this 14092.00 i should get output like this 14,092.00
I should write output with comma separator .is there any key word or f.m for this one?Hi Priya,
You have two options.
1) Changes in user master record ie change thousand separator as , and decimal separator as .(dot).
You can do this with transaction SU3.
2) If you dont want to change master record then try with this code.
DATA VC_TFULLVACWTG(18).
VC_TFULLVACWTG = TFULLVACWTG.
TRANSLATE VC_TFULLVACWTG USING ',#'.
TRANSLATE VC_TFULLVACWTG USING '.,'.
TRANSLATE VC_TFULLVACWTG USING '#.'.
WRITE VC_TFULLVACWTG.
Thanks,
Vinay -
How can I return multiple values with PL/SQL Web Services
Hi,
I'm new to developping Web Services. I'm doing some tests with JDeveloper and OC4J on my local machine with a Web Services based on a PL/SQL function within a package. Right now that function only returns one value. So the xml response only has one output.
I'd like to know how can I return multiple values with my PL/SQL Web Service. For example, if I want to return an employee's name and id? And that the xml contains two output : <employee>, <empid>?
Reginald
ps : I have searched the forum and I couldn't find an answer to this question, if that has been discussed AND answered before, can you please post the link? ThanksAlright, I actually found my answer. Since this was asked I think as a followup somewhere else I'll give my answer.
It is very simple, all you have to do is create an Object Type and then Return that object type. After that, JDeveloper will take care of everything and you will have an xml response with multiple values. Here
{color:#ff0000}
create or replace TYPE person AS OBJECT
( id_interv number,
first_name VARCHAR2(50),
last_name VARCHAR2(50),
date_birth date
);{color}
Then your function used in your Web Service should look something like this :
{color:#ff0000}
function info_emp (p_empno IN VARCHAR2) RETURN person AS
l_emp person := person(-1,'','','');
BEGIN
SELECT first_name
,last_name
,emp_no
INTO l_emp.first_name
,l_emp.last_name
,l_emp.emp_no
FROM emp
WHERE upper(emp_no) = upper (emp_no);
{color}
{color:#ff0000}
RETURN l_emp;
EXCEPTION WHEN NO_DATA_FOUND THEN
l_emp := person (-1,'n/a','n/a','n/a');
RETURN l_emp ;
END info_emp;{color}
{color:#ff0000}{color:#000000}After that, this is what the xml response looks like :{color}{color}
<first_name xsi:type="xsd:string">John</first_name>
<last_name xsi:type="xsd:string">Doe</last_name>
<emp_no xsi:type="xsd:string">0250193</emp_no> -
How can I separate one column into multiple column?
How can I separate one column into multiple column?
This is what I have:
BUYER_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE
0001 PHONE_NUMBER 555-555-0001
0001 EMAIL [email protected]
0001 CURRENCY USD
0002 PHONE_NUMBER 555-555-0002
0002 EMAIL [email protected]
0002 CURRENCY USD
0003 PHONE_NUMBER 555-555-0003
0003 EMAIL [email protected]
0003 CURRENCY CAD
This is what I would like to have:
BUYER_ID PHONE_NUMBER EMAIL CURRENCY
0001 555-555-0001 [email protected] USD
0002 555-555-0002 [email protected] USD
0003 555-555-0003 [email protected] CAD
Any help would be greatly appreciated.This is another solution. Suppose your actual table's name is test(which has the redundant data). create a table like this:
CREATE TABLE test2 (BUYER_ID number(10),PHONE_NUMBER varchar2(50),EMAIL varchar2(50),CURRENCY varchar2(50));
then you will type this procedure:
declare
phone_number_v varchar2(50);
EMAIL_v varchar2(50);
CURRENCY_v varchar2(50);
cursor my_test is select * from test;
begin
for my_test_curs in my_test loop
select ATTRIBUTE_VALUE INTO phone_number_v from test
where person_id=my_test_curs.person_id
and attribute_name ='PHONE_NUMBER';
select ATTRIBUTE_VALUE INTO EMAIL_v from test
where person_id=my_test_curs.person_id
and attribute_name ='EMAIL';
select ATTRIBUTE_VALUE INTO CURRENCY_v from test
where person_id=my_test_curs.person_id
and attribute_name ='CURRENCY';
INSERT INTO test2
VALUES (my_test_curs.person_id,phone_number_v,EMAIL_v,CURRENCY_v);
END LOOP;
END;
Then you will create your final table like this:
create table final_table as select * from test2 where 1=2;
After that write this code:
INSERT ALL
into final_table
SELECT DISTINCT(BUYER_ID),PHONE_NUMBER,EMAIL,CURRENCY
FROM TEST2;
If you have a huge amount of data in your original table this solution may take a long time to do what you need. -
'BBPSC11' error in Monitor SC for one User having multiple positions but on
Hello,
'BBPSC11' error in Monitor SC for one User - having multiple positions in org structure - but having one BP code associated to all positions.
We have one BP ID associated to multiple positions of the same user - in multiple org structure.
The org unit is refered as one Project and like wise we have multiple projects people worked on.
Once the Proj is over we move the Users from one Proj (Org unit) to another Proj, with new Position created copying the old and associate old BP code to it.
With this when we go for Monitor SC option - enter User ID in Created By field - old SC are listed but we are getting error if we click on the Detail icon.
Error:The Internet Transaction Server could not start the transaction "BBPSC11" because of the following error: Attribute for user contains errors. Inform systemadmin. .
ADHi,
Pl. verify the user with txn-bbp_attr_check. It could be that the org. relationship of the user changed with what was captured on shopping cart. Also use txn-users_gen to repair the user.
Regards,
Sanjeev -
I am having multiple issues with syncing my iphone calendar and outlook calendar on my laptop
I mostly enter the original items on my laptop
There are often 1 hour time differences in the entries on the 2 devices and sometimes events that have been amended are not updated on iphoneThis sounds like an error in Time Zone support. The time zone needs to be the same in Outlook as well as the phone.
-
Query on column with comma separated values
I have a proposed table with unnormalized data like the following:
ID COLA COLB REFLIST
21 xxx zzz 24,25,78,412
22 xxx xxx 21
24 yyy xxx 912,22
25 zzz fff 433,555,22
.. ... ... ...There are 200 million rows. There is maximum of about 10 IDs in the REFLIST, though typically two or three. How could I efficiently query this data on the REFLIST column? e.g. something like:
SELECT id FROM mytable WHERE :myval in reflistLogically there is a many to many relationship between rows in this table. The REFLIST column contains pointers to ID values elsewhere in the table. The data could be normalized so that the relationship keys are in a separate table (in fact this is the current solution that we want to change).
ID REF
21 24
21 25
21 78
21 412
22 21
24 912
... ...The comma separated list seems instinctively like a bad idea, however there are various reasons for proposing it. The main reason is because the source for this data has it structured like the REFLIST example. It is an OLTP-like system rather than a data warehouse. The source code (and edit performance) would benefit greatly from not having to maintain the relationship table as the data changes.
Going back to querying the REFLIST column, the problem seems to be building an approriate index for the data. The ideas proposed so far are:
<li>Make a materialized view that presents the relationships as normalized (e.g. as in the example with ID, REF columns above), then index the plain column - the various methods of writing the view SQL have been widely posted.
<li>Use a Oracle Text Index (not something I have ever had call to use before).
Any other ideas? Its Oracle 10.2, though 11g could be possible.
Thanks
JimSomething like this ?
This is test demo on my 11.2.0.1 Windows XP
SQL> create table test (id number,reflist varchar2(30));
Table created.
SQL> insert into test values (21,'24,25,78,412');
1 row created.
SQL> insert into test values (22,'21');
1 row created.
SQL> insert into test values (24,'912,22');
1 row created.
SQL> insert into test values (25,'433,555,22');
1 row created.
SQL> select * from test
2 where
3 ',' || reflist || ',' like '%,22,%';
ID REFLIST
24 912,22
25 433,555,22
SQL>Source:http://stackoverflow.com/questions/7212282/is-it-possible-to-query-a-comma-separated-column-for-a-specific-value
Regards
Girish Sharma
Edited by: Girish Sharma on Jul 12, 2012 2:31 PM -
SQL Select with comma separated column value
Hi All
ASP VBScript
I have a DB column named allowed_contracts that stores a
comma separated
list of of values e.g. 3, 5, 19, 44, 52
I need to select records based on a variable called
varContractList that
contains another comma separated list i.e. 5, 44, 52
I only want to select records where the allowed_contracts
column contains
each of the varContractList,
For example only return records that have 5 or 44 or 52 in
thier
allowed_contracts column.
My brain is now in a persistant vegetive state trying to work
this out so
any ideas would be much appreciated.
Regards
BrenHi Jules
Cheers for this.
I was trying to be a bit cute (lazy even) by storing the
project ID's as a
comma delimted string but as we see it doesn't always pay to
be lazy. Serves
me right for destroying brain cells by drinking the Welshpool
beer the other
week whilst visiting mates down that neck of the woods. :-))
Time for another table me thinks.
Rgds
Bren
"Julian Roberts" <[email protected]> wrote in message
news:e7i13f$mup$[email protected]..
> Fatal flaw here Bren. In a relational database, one
shouldn't really store
> foreign keys as a comma delimted string. One should have
a 3 table
> structure. eg
>
> Products:
> ProductID
> Product
>
> Categories:
> CategoryID
> Category
>
> ProductCategories:
> ProductID
> CategoryID
>
> So, from the table ProductCategories, a product can
belong to many
> categories. When doing a front end search to find
products in multiple
> categories, products can be shown thus:
>
> select * from Products where ProductID in (select
ProductID from
> ProductCategories where CategoryID in (5,44))
>
> --
> Jules
>
http://www.charon.co.uk/charoncart
> Charon Cart 3
> Shopping Cart Extension for Dreamweaver MX/MX 2004
>
>
>
>
> -
Not Working-LexicalParamater used to send multiple values with one prameter
Hi,
I am calling a reportname.rdf from the web(using apache webserver and url as follows:
http://localhost/cgi-bin/rwcgi60.exe?server=reportservername&report=acctActivity.rdf&userid=bizsystest/[email protected]&destype=cache&desformat=pdf&placeholdercolumnname='2,3,4'&docid=2
I have to send multiple values for fundid.
To accomplish this,
I created a placeholder column and initialized the value '0' and type taken as character(even though datatype of this column is number).
In sql query
select table1.c1, table2.c2 from table1, table2, table3, table4 where table1.cl in (&placeholdercolumname)
and table1.c2 = table2.c2(+)
and table3.doccode = :docid
From Web, URL contains the placeholdercolumnnmae='2,3,4'
Still its taking the value zero and output is generating.
Its not taking my newvalues ('2,3,4') in IN parameter.
I donot know the reason, where exactly is wrong.
Please help me to resolve.
2. My Second Issue:
Is there anyway, can we hide all key/value parameters send through the URL not visible to endusers
like servername, database userid and password and configure some where, so system can pickup each time when I run report.
Please help me to resolve.
Thanks,
Usha.Hi Usha,
First of all, I assume that the place holder column you have specified is a UserParameter which you have specified on the command line. I don't think there is any direct way of doing that.
I created a placeholder column and initialized the value '0' and type taken as character(even though datatype of this column is number). If I infer correctly from what you are saying, you can't mix and match the datatypes of the columns, you can't define the parameter as a number and pass characters. I suggest you declare your parameter as a character with sufficient width to hold your LOV and then process them convert them to numbers.
Another suggestion is try replacing your "Placeholder" with another query construct.
For your Second issue,
You can use the Key-Map file Oracle Reports provides for the Web client. Please refer to
<ORACLE_HOME>\Report60\server\cgicmd.dat.
In the cgicmd.dat,you can alias your entire commandline with a single key and use that key in your URL.
Regards
Oracle Reports Team. -
Sales order with line items having multiple values in multiple currency
Please suggest solution for creating sales order having line items with multiple values in multiple currencies.
e.g. Line Item A Qty/1 No, value 100INR100$100EUR. Customer wants all three values to display at sales order line item level and create billing in 3 currencies.Hi,
As far as my understanding it may be possible round the solution,
For 1 company code we can able to maintain 3 currancies,
1 currancy is hard currance & other two are dual currancies.
Create sales order with 3 line items having 3 diffrant currancies
Spilt invoice on the basis of currancy
Last pass to this invoices to accounting.
Whole process is
Sales order >>> Delivery >>> Invoice 1, Invoice 2, Invoice 3(Split invoice on basis of Currancy).
Consult with FI Team they will tell you about dual currancy & hard currancy
Kapil
Maybe you are looking for
-
Hi I would like to know if I can add a field in a cube without deleting the data as I dont want previous data for this added field. I am just interested in the new data coming through Delta in the cube. Many Thanks. Kind Regards, Kate
-
While installing windows with bootcamp error showing "A require Cd/Drive driver is missing" in the middle of installation m not able to install windows on my mac . Please help what to do ??
-
Acrobat 9 and Acrobat 6 co-installation?
I have perused the forum for this issue and have repeatedly...and sadly...learned that Office 2000 support is not available in Acrobat 9 PDFMaker.It also appears that there are no updates or plugins to fix this oversight. Therefore, I would like to
-
We bought the new iphone 5s when they came out from at&t and my dad has completely shut off and won't do anything? It has not been in ANY water or anything else that could have caused this.
-
SRM UWL: Overwrite Inbox-View property excludePreviewSections
Hi, we are working with an UWL wich combines SRM BRF Workflows and indivdual oney as well. WEe have to use the inbox iview provided by SRM which sets the property excludePreviewSections to "Attributes, Description, Attachments, Notes, UserDecision".